Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -56,7 +56,6 @@ def infer(prompt, seed=42, randomize_seed=False, width=1024, height=1024, guidan
|
|
56 |
):
|
57 |
yield img, seed
|
58 |
|
59 |
-
|
60 |
examples = [
|
61 |
"a man walking in the forest",
|
62 |
"a viking ship sailing down a river",
|
@@ -84,9 +83,6 @@ css = """
|
|
84 |
"""
|
85 |
|
86 |
with gr.Blocks(css=css) as natalie_diffusion:
|
87 |
-
# Predefine result image so it's accessible to both sides
|
88 |
-
result = gr.Image(label="", show_label=False, elem_id="generated-image")
|
89 |
-
|
90 |
with gr.Row():
|
91 |
with gr.Column(scale=1, elem_id="left-column"):
|
92 |
gr.Markdown("""
|
@@ -119,17 +115,20 @@ Generate images in the surreal style of artist [Natalie Kav](https://www.behance
|
|
119 |
guidance_scale = gr.Slider(label="Guidance Scale", minimum=1, maximum=15, step=0.1, value=3.5)
|
120 |
num_inference_steps = gr.Slider(label="Number of inference steps", minimum=1, maximum=50, step=1, value=28)
|
121 |
|
|
|
|
|
|
|
122 |
gr.Examples(
|
123 |
examples=examples,
|
124 |
fn=infer,
|
125 |
inputs=[prompt],
|
126 |
-
outputs=[
|
127 |
cache_examples=True,
|
128 |
cache_mode="lazy"
|
129 |
)
|
130 |
|
131 |
with gr.Column(scale=1, elem_id="right-column"):
|
132 |
-
result.
|
133 |
|
134 |
gr.on(
|
135 |
triggers=[run_button.click, prompt.submit],
|
|
|
56 |
):
|
57 |
yield img, seed
|
58 |
|
|
|
59 |
examples = [
|
60 |
"a man walking in the forest",
|
61 |
"a viking ship sailing down a river",
|
|
|
83 |
"""
|
84 |
|
85 |
with gr.Blocks(css=css) as natalie_diffusion:
|
|
|
|
|
|
|
86 |
with gr.Row():
|
87 |
with gr.Column(scale=1, elem_id="left-column"):
|
88 |
gr.Markdown("""
|
|
|
115 |
guidance_scale = gr.Slider(label="Guidance Scale", minimum=1, maximum=15, step=0.1, value=3.5)
|
116 |
num_inference_steps = gr.Slider(label="Number of inference steps", minimum=1, maximum=50, step=1, value=28)
|
117 |
|
118 |
+
# Define hidden result image just for example caching
|
119 |
+
result_example = gr.Image(visible=False)
|
120 |
+
|
121 |
gr.Examples(
|
122 |
examples=examples,
|
123 |
fn=infer,
|
124 |
inputs=[prompt],
|
125 |
+
outputs=[result_example, seed],
|
126 |
cache_examples=True,
|
127 |
cache_mode="lazy"
|
128 |
)
|
129 |
|
130 |
with gr.Column(scale=1, elem_id="right-column"):
|
131 |
+
result = gr.Image(label="", show_label=False, elem_id="generated-image")
|
132 |
|
133 |
gr.on(
|
134 |
triggers=[run_button.click, prompt.submit],
|