Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -8,27 +8,20 @@ def generate_image(text, seed):
|
|
8 |
if seed is not None:
|
9 |
random.seed(seed)
|
10 |
|
11 |
-
|
12 |
-
|
13 |
-
f"{text}, front view",
|
14 |
-
f"{text}, side view",
|
15 |
-
f"{text}, dynamic pose",
|
16 |
-
f"{text}, close-up view"
|
17 |
-
]
|
18 |
|
19 |
-
|
20 |
-
images = [model(variation) for variation in variations]
|
21 |
-
return images
|
22 |
|
23 |
-
#
|
24 |
examples = [
|
25 |
-
["Humanoid Cat Warrior, Full View", None
|
26 |
-
["Warhammer Sisterhood", None
|
27 |
-
["Future Robots war", None
|
28 |
-
["Fantasy dragon", None
|
29 |
]
|
30 |
|
31 |
-
# Custom CSS for
|
32 |
css = """
|
33 |
/* General button styles */
|
34 |
button {
|
@@ -68,20 +61,16 @@ input[type=range] {
|
|
68 |
}
|
69 |
"""
|
70 |
|
71 |
-
#
|
72 |
-
def create_example_row(example):
|
73 |
-
return [gr.Example(value=example[0], examples=None, label=example[0], image=example[2])]
|
74 |
-
|
75 |
-
# Gradio interface
|
76 |
interface = gr.Interface(
|
77 |
fn=generate_image,
|
78 |
inputs=[
|
79 |
gr.Textbox(label="Type your imagination:", placeholder="Type or select an example..."),
|
80 |
gr.Slider(minimum=0, maximum=10000, step=1, label="Seed (optional)")
|
81 |
],
|
82 |
-
outputs=
|
83 |
-
examples=
|
84 |
-
css=css,
|
85 |
description="Note: The model is running on CPU; processing might take a bit longer. Thank you for your patience!"
|
86 |
)
|
87 |
|
|
|
8 |
if seed is not None:
|
9 |
random.seed(seed)
|
10 |
|
11 |
+
if text in [example[0] for example in examples]:
|
12 |
+
print(f"Using example: {text}")
|
|
|
|
|
|
|
|
|
|
|
13 |
|
14 |
+
return model(text)
|
|
|
|
|
15 |
|
16 |
+
# Examples for user guidance
|
17 |
examples = [
|
18 |
+
["Humanoid Cat Warrior, Full View", None],
|
19 |
+
["Warhammer Sisterhood", None],
|
20 |
+
["Future Robots war", None],
|
21 |
+
["Fantasy dragon", None]
|
22 |
]
|
23 |
|
24 |
+
# Custom CSS for gradient buttons and capsule shapes
|
25 |
css = """
|
26 |
/* General button styles */
|
27 |
button {
|
|
|
61 |
}
|
62 |
"""
|
63 |
|
64 |
+
# Gradio interface with custom styles
|
|
|
|
|
|
|
|
|
65 |
interface = gr.Interface(
|
66 |
fn=generate_image,
|
67 |
inputs=[
|
68 |
gr.Textbox(label="Type your imagination:", placeholder="Type or select an example..."),
|
69 |
gr.Slider(minimum=0, maximum=10000, step=1, label="Seed (optional)")
|
70 |
],
|
71 |
+
outputs=gr.Image(label="Generated Image"),
|
72 |
+
examples=examples,
|
73 |
+
css=css, # Apply custom CSS styling
|
74 |
description="Note: The model is running on CPU; processing might take a bit longer. Thank you for your patience!"
|
75 |
)
|
76 |
|