Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -3,21 +3,27 @@ import random
|
|
| 3 |
|
| 4 |
model = gr.load("models/Purz/face-projection")
|
| 5 |
|
| 6 |
-
def generate_image(text,
|
| 7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
|
| 9 |
examples = [
|
| 10 |
-
["Humanoid Cat Warrior, Full View",
|
| 11 |
-
["Warhammer Sisterhood",
|
| 12 |
-
["Future Robots war",
|
| 13 |
-
["Fantasy dragon",
|
| 14 |
]
|
| 15 |
|
| 16 |
interface = gr.Interface(
|
| 17 |
fn=generate_image,
|
| 18 |
inputs=[
|
| 19 |
gr.Textbox(label="Type here your imagination:", placeholder="Type or click an example..."),
|
| 20 |
-
gr.
|
| 21 |
],
|
| 22 |
outputs=gr.Image(label="Generated Image"),
|
| 23 |
examples=examples,
|
|
|
|
| 3 |
|
| 4 |
model = gr.load("models/Purz/face-projection")
|
| 5 |
|
| 6 |
+
def generate_image(text, seed):
|
| 7 |
+
if seed is not None:
|
| 8 |
+
random.seed(seed)
|
| 9 |
+
|
| 10 |
+
if text in [example[0] for example in examples]:
|
| 11 |
+
print(f"Using example: {text}")
|
| 12 |
+
|
| 13 |
+
return model(text)
|
| 14 |
|
| 15 |
examples = [
|
| 16 |
+
["Humanoid Cat Warrior, Full View", None],
|
| 17 |
+
["Warhammer Sisterhood", None],
|
| 18 |
+
["Future Robots war", None],
|
| 19 |
+
["Fantasy dragon", None]
|
| 20 |
]
|
| 21 |
|
| 22 |
interface = gr.Interface(
|
| 23 |
fn=generate_image,
|
| 24 |
inputs=[
|
| 25 |
gr.Textbox(label="Type here your imagination:", placeholder="Type or click an example..."),
|
| 26 |
+
gr.Slider(minimum=0, maximum=10000, step=1, label="Seed (optional)")
|
| 27 |
],
|
| 28 |
outputs=gr.Image(label="Generated Image"),
|
| 29 |
examples=examples,
|