Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -230,18 +230,33 @@ css="""
|
|
230 |
"""
|
231 |
|
232 |
with gr.Blocks(css=css) as demo:
|
233 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
234 |
prompt_in = gr.Textbox(
|
235 |
label="Prompt",
|
236 |
placeholder="Type your prompt here...",
|
237 |
lines=2
|
238 |
)
|
239 |
-
|
240 |
with gr.Row():
|
241 |
image_out_1 = gr.Image(type="numpy", label="Blur σ = 0")
|
242 |
image_out_2 = gr.Image(type="numpy", label="Blur σ = 10")
|
243 |
-
|
244 |
-
|
245 |
with gr.Row():
|
246 |
cfg_slider = gr.Slider(
|
247 |
minimum=1.0, maximum=20.0, value=7.5, step=0.1,
|
@@ -251,14 +266,14 @@ with gr.Blocks(css=css) as demo:
|
|
251 |
minimum=5.0, maximum=100.0, value=10.0, step=0.1,
|
252 |
label="Blur σ"
|
253 |
)
|
254 |
-
|
255 |
generate_btn = gr.Button("Generate")
|
256 |
-
|
257 |
gr.Examples(
|
258 |
examples = examples,
|
259 |
inputs = [prompt_in]
|
260 |
)
|
261 |
-
|
262 |
# wire up
|
263 |
generate_btn.click(
|
264 |
fn=gradio_generate,
|
@@ -267,7 +282,7 @@ with gr.Blocks(css=css) as demo:
|
|
267 |
).then(fn=gradio_generate,
|
268 |
inputs=[prompt_in, cfg_slider, blur_slider],
|
269 |
outputs=image_out_2)
|
270 |
-
|
271 |
# 2) Whenever the blur slider moves, update the second image’s label:
|
272 |
blur_slider.change(
|
273 |
lambda b: gr.update(label=f"Blur σ = {b}"),
|
|
|
230 |
"""
|
231 |
|
232 |
with gr.Blocks(css=css) as demo:
|
233 |
+
|
234 |
+
gr.HTML(
|
235 |
+
"""
|
236 |
+
<div style="text-align: center;">
|
237 |
+
<h1>StableEnergy</h1>
|
238 |
+
<p style="font-size:16px;">Smoothed Energy Guidance in Stable Diffusion 2.1 </p>
|
239 |
+
</div>
|
240 |
+
<br>
|
241 |
+
<div style="display: flex; justify-content: center; align-items: center; text-align: center;">
|
242 |
+
<a href="https://x.com/alexandernasa" target="_blank"><img src="https://img.shields.io/twitter/url/https/twitter.com/cloudposse.svg?style=social&label=alexnasa"></a>  
|
243 |
+
<a href="https://x.com/OutofAi" target="_blank"><img src="https://img.shields.io/twitter/url/https/twitter.com/cloudposse.svg?style=social&label=OutofAi"></a>
|
244 |
+
</div>
|
245 |
+
"""
|
246 |
+
)
|
247 |
+
|
248 |
+
with gr.Column(elem_id="col-container"):
|
249 |
prompt_in = gr.Textbox(
|
250 |
label="Prompt",
|
251 |
placeholder="Type your prompt here...",
|
252 |
lines=2
|
253 |
)
|
254 |
+
|
255 |
with gr.Row():
|
256 |
image_out_1 = gr.Image(type="numpy", label="Blur σ = 0")
|
257 |
image_out_2 = gr.Image(type="numpy", label="Blur σ = 10")
|
258 |
+
|
259 |
+
|
260 |
with gr.Row():
|
261 |
cfg_slider = gr.Slider(
|
262 |
minimum=1.0, maximum=20.0, value=7.5, step=0.1,
|
|
|
266 |
minimum=5.0, maximum=100.0, value=10.0, step=0.1,
|
267 |
label="Blur σ"
|
268 |
)
|
269 |
+
|
270 |
generate_btn = gr.Button("Generate")
|
271 |
+
|
272 |
gr.Examples(
|
273 |
examples = examples,
|
274 |
inputs = [prompt_in]
|
275 |
)
|
276 |
+
|
277 |
# wire up
|
278 |
generate_btn.click(
|
279 |
fn=gradio_generate,
|
|
|
282 |
).then(fn=gradio_generate,
|
283 |
inputs=[prompt_in, cfg_slider, blur_slider],
|
284 |
outputs=image_out_2)
|
285 |
+
|
286 |
# 2) Whenever the blur slider moves, update the second image’s label:
|
287 |
blur_slider.change(
|
288 |
lambda b: gr.update(label=f"Blur σ = {b}"),
|