Spaces:
Running
on
Zero
Running
on
Zero
UI suggestions
Browse files
app.py
CHANGED
@@ -51,7 +51,7 @@ def predict(prompt, seed=42, randomize_seed=False, guidance_scale=5.0, num_infer
|
|
51 |
width=WIDTH
|
52 |
).images[0]
|
53 |
|
54 |
-
return export_to_gif(split_image(image, 4), "flux.gif", fps=4), seed
|
55 |
|
56 |
demo = gr.Interface(fn=predict, inputs="text", outputs="image")
|
57 |
|
@@ -60,6 +60,7 @@ css="""
|
|
60 |
margin: 0 auto;
|
61 |
max-width: 520px;
|
62 |
}
|
|
|
63 |
"""
|
64 |
examples = [
|
65 |
"a cat waving its paws in the air",
|
@@ -75,34 +76,8 @@ with gr.Blocks(css=css) as demo:
|
|
75 |
prompt = gr.Text(label="Prompt", show_label=False, max_lines=1, placeholder="Enter your prompt")
|
76 |
submit = gr.Button("Submit", scale=0)
|
77 |
|
78 |
-
with gr.Accordion("Advanced Settings", open=False):
|
79 |
-
seed = gr.Slider(
|
80 |
-
label="Seed",
|
81 |
-
minimum=0,
|
82 |
-
maximum=MAX_SEED,
|
83 |
-
step=1,
|
84 |
-
value=0,
|
85 |
-
)
|
86 |
-
|
87 |
-
randomize_seed = gr.Checkbox(label="Randomize seed", value=True)
|
88 |
-
|
89 |
-
with gr.Row():
|
90 |
-
guidance_scale = gr.Slider(
|
91 |
-
label="Guidance Scale",
|
92 |
-
minimum=1,
|
93 |
-
maximum=15,
|
94 |
-
step=0.1,
|
95 |
-
value=3.5,
|
96 |
-
)
|
97 |
-
num_inference_steps = gr.Slider(
|
98 |
-
label="Number of inference steps",
|
99 |
-
minimum=1,
|
100 |
-
maximum=50,
|
101 |
-
step=1,
|
102 |
-
value=28,
|
103 |
-
)
|
104 |
-
|
105 |
output = gr.Image(label="GIF", show_label=False)
|
|
|
106 |
gr.Examples(
|
107 |
examples=examples,
|
108 |
fn=predict,
|
@@ -110,12 +85,38 @@ with gr.Blocks(css=css) as demo:
|
|
110 |
outputs=[output, seed],
|
111 |
cache_examples="lazy"
|
112 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
113 |
|
114 |
gr.on(
|
115 |
triggers=[submit.click, prompt.submit],
|
116 |
fn=predict,
|
117 |
inputs=[prompt, seed, randomize_seed, guidance_scale, num_inference_steps],
|
118 |
-
outputs = [output, seed]
|
119 |
)
|
120 |
|
121 |
demo.launch()
|
|
|
51 |
width=WIDTH
|
52 |
).images[0]
|
53 |
|
54 |
+
return export_to_gif(split_image(image, 4), "flux.gif", fps=4), output_stills, seed
|
55 |
|
56 |
demo = gr.Interface(fn=predict, inputs="text", outputs="image")
|
57 |
|
|
|
60 |
margin: 0 auto;
|
61 |
max-width: 520px;
|
62 |
}
|
63 |
+
#stills{max-height:160px}
|
64 |
"""
|
65 |
examples = [
|
66 |
"a cat waving its paws in the air",
|
|
|
76 |
prompt = gr.Text(label="Prompt", show_label=False, max_lines=1, placeholder="Enter your prompt")
|
77 |
submit = gr.Button("Submit", scale=0)
|
78 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
79 |
output = gr.Image(label="GIF", show_label=False)
|
80 |
+
output_stills = gr.Image(label="stills", show_label=False, elem_id="stills")
|
81 |
gr.Examples(
|
82 |
examples=examples,
|
83 |
fn=predict,
|
|
|
85 |
outputs=[output, seed],
|
86 |
cache_examples="lazy"
|
87 |
)
|
88 |
+
with gr.Accordion("Advanced Settings", open=False):
|
89 |
+
seed = gr.Slider(
|
90 |
+
label="Seed",
|
91 |
+
minimum=0,
|
92 |
+
maximum=MAX_SEED,
|
93 |
+
step=1,
|
94 |
+
value=0,
|
95 |
+
)
|
96 |
+
|
97 |
+
randomize_seed = gr.Checkbox(label="Randomize seed", value=True)
|
98 |
+
|
99 |
+
with gr.Row():
|
100 |
+
guidance_scale = gr.Slider(
|
101 |
+
label="Guidance Scale",
|
102 |
+
minimum=1,
|
103 |
+
maximum=15,
|
104 |
+
step=0.1,
|
105 |
+
value=3.5,
|
106 |
+
)
|
107 |
+
num_inference_steps = gr.Slider(
|
108 |
+
label="Number of inference steps",
|
109 |
+
minimum=1,
|
110 |
+
maximum=50,
|
111 |
+
step=1,
|
112 |
+
value=28,
|
113 |
+
)
|
114 |
|
115 |
gr.on(
|
116 |
triggers=[submit.click, prompt.submit],
|
117 |
fn=predict,
|
118 |
inputs=[prompt, seed, randomize_seed, guidance_scale, num_inference_steps],
|
119 |
+
outputs = [output, output_stills, seed]
|
120 |
)
|
121 |
|
122 |
demo.launch()
|