Spaces:
Runtime error
Runtime error
Commit
·
6d0841b
1
Parent(s):
013d4ed
Update app.py
Browse files
app.py
CHANGED
|
@@ -104,68 +104,74 @@ css = """
|
|
| 104 |
}
|
| 105 |
"""
|
| 106 |
|
| 107 |
-
|
| 108 |
|
| 109 |
-
with gr.Blocks(css=css) as demo:
|
| 110 |
-
with gr.Row():
|
| 111 |
-
gr.Markdown("""
|
| 112 |
-
<h1><center>Stable Diffusion</center></h1>
|
| 113 |
|
| 114 |
-
|
| 115 |
-
with gr.Row():
|
| 116 |
-
with gr.Column(scale=6, min_width=600):
|
| 117 |
-
prompt = gr.Textbox(label="Prompt", placeholder="beautiful cat, 8k", show_label=True, lines=2)
|
| 118 |
-
negative_prompt = gr.Textbox(label="Negative Prompt", value="text, blurry, fuzziness", placeholder="What you don't want to see in the image", show_label=True, lines=3)
|
| 119 |
-
with gr.Column():
|
| 120 |
-
text_button = gr.Button("Generate", variant='primary', elem_id="generate")
|
| 121 |
-
|
| 122 |
with gr.Row():
|
| 123 |
-
|
| 124 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 125 |
|
| 126 |
-
|
| 127 |
-
|
| 128 |
-
|
| 129 |
-
|
| 130 |
-
with gr.
|
| 131 |
-
|
| 132 |
-
|
| 133 |
-
|
| 134 |
-
|
| 135 |
-
|
| 136 |
-
|
| 137 |
-
"
|
| 138 |
-
|
| 139 |
-
|
| 140 |
-
|
| 141 |
-
|
| 142 |
-
|
| 143 |
-
|
| 144 |
-
|
| 145 |
-
|
| 146 |
-
|
| 147 |
-
|
| 148 |
-
|
| 149 |
-
|
| 150 |
-
|
| 151 |
-
|
| 152 |
-
|
| 153 |
-
|
| 154 |
-
|
|
|
|
|
|
|
|
|
|
| 155 |
|
| 156 |
-
|
| 157 |
-
|
| 158 |
|
| 159 |
with gr.Row():
|
| 160 |
with gr.Column(scale=1):
|
| 161 |
width = gr.Slider(label="Width", maximum=1024, value=512, step=8)
|
| 162 |
height = gr.Slider(label="Height", maximum=1024, value=512, step=8)
|
| 163 |
|
| 164 |
-
|
| 165 |
-
|
|
|
|
| 166 |
|
|
|
|
|
|
|
| 167 |
|
| 168 |
-
|
|
|
|
| 169 |
|
| 170 |
demo.queue(concurrency_count=10)
|
| 171 |
demo.launch()
|
|
|
|
| 104 |
}
|
| 105 |
"""
|
| 106 |
|
| 107 |
+
with gr.Blocks(css=css, theme="Base") as demo:
|
| 108 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 109 |
|
| 110 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 111 |
with gr.Row():
|
| 112 |
+
gr.Markdown("<h1><center>Stable Diffusion Demo</center></h1>")
|
| 113 |
+
with gr.Tab("Playground"):
|
| 114 |
+
with gr.Row():
|
| 115 |
+
with gr.Column(scale=6, min_width=600):
|
| 116 |
+
prompt = gr.Textbox(label="Prompt", placeholder="beautiful cat, 8k", show_label=True, lines=2)
|
| 117 |
+
negative_prompt = gr.Textbox(label="Negative Prompt", value="text, blurry, fuzziness", placeholder="text, blurry, fuzziness", show_label=True, lines=3)
|
| 118 |
+
with gr.Column():
|
| 119 |
+
text_button = gr.Button("Generate", variant='primary', elem_id="generate")
|
| 120 |
+
|
| 121 |
+
with gr.Row():
|
| 122 |
+
with gr.Column(scale=3):
|
| 123 |
+
|
| 124 |
|
| 125 |
+
with gr.Column(scale=2):
|
| 126 |
+
image_output = gr.Image()
|
| 127 |
+
|
| 128 |
+
with gr.Accordion("Advanced options", open=False):
|
| 129 |
+
with gr.Row():
|
| 130 |
+
with gr.Column(scale=6):
|
| 131 |
+
model = gr.Dropdown(interactive=True,value="v1-5-pruned-emaonly.safetensors [d7049739]", show_label=True, label="Stable Diffusion Checkpoint", choices=prodia_client.list_models())
|
| 132 |
+
|
| 133 |
+
|
| 134 |
+
with gr.Row():
|
| 135 |
+
with gr.Column(scale=1):
|
| 136 |
+
sampler = gr.Dropdown(value="DPM++ SDE", show_label=True, label="Sampler", choices=[
|
| 137 |
+
"Euler",
|
| 138 |
+
"Euler a",
|
| 139 |
+
"LMS",
|
| 140 |
+
"Heun",
|
| 141 |
+
"DPM2",
|
| 142 |
+
"DPM2 a",
|
| 143 |
+
"DPM++ 2S a",
|
| 144 |
+
"DPM++ 2M",
|
| 145 |
+
"DPM++ SDE",
|
| 146 |
+
"DPM fast",
|
| 147 |
+
"DPM adaptive",
|
| 148 |
+
"LMS Karras",
|
| 149 |
+
"DPM2 Karras",
|
| 150 |
+
"DPM2 a Karras",
|
| 151 |
+
"DPM++ 2S a Karras",
|
| 152 |
+
"DPM++ 2M Karras",
|
| 153 |
+
"DPM++ SDE Karras",
|
| 154 |
+
"DDIM",
|
| 155 |
+
"PLMS",
|
| 156 |
+
])
|
| 157 |
|
| 158 |
+
with gr.Column(scale=1):
|
| 159 |
+
steps = gr.Slider(label="Steps", minimum=1, maximum=50, value=30, step=1)
|
| 160 |
|
| 161 |
with gr.Row():
|
| 162 |
with gr.Column(scale=1):
|
| 163 |
width = gr.Slider(label="Width", maximum=1024, value=512, step=8)
|
| 164 |
height = gr.Slider(label="Height", maximum=1024, value=512, step=8)
|
| 165 |
|
| 166 |
+
with gr.Column(scale=1):
|
| 167 |
+
batch_size = gr.Slider(label="Batch Size", maximum=1, value=1)
|
| 168 |
+
batch_count = gr.Slider(label="Batch Count", maximum=1, value=1)
|
| 169 |
|
| 170 |
+
cfg_scale = gr.Slider(label="CFG Scale", minimum=1, maximum=20, value=7, step=1)
|
| 171 |
+
seed = gr.Number(label="Seed", value=-1, info="""'-1' is random seed""")
|
| 172 |
|
| 173 |
+
|
| 174 |
+
text_button.click(flip_text, inputs=[prompt, negative_prompt, model, steps, sampler, cfg_scale, width, height, seed], outputs=image_output)
|
| 175 |
|
| 176 |
demo.queue(concurrency_count=10)
|
| 177 |
demo.launch()
|