Update app.py
Browse files
app.py
CHANGED
|
@@ -201,7 +201,7 @@ with gr.Blocks(css=css, theme=theme, fill_width= False) as app:
|
|
| 201 |
|
| 202 |
with gr.Tab("Basic Settings"):
|
| 203 |
with gr.Row():
|
| 204 |
-
prompt = gr.Textbox(placeholder="Enter the image description...", show_label=True, label='
|
| 205 |
with gr.Row():
|
| 206 |
task = gr.Radio(interactive=True, value="Stable Diffusion XL 1.0", show_label=True, label="Model of neural network:", choices=['Stable Diffusion XL 1.0', 'Crystal Clear XL',
|
| 207 |
'Juggernaut XL', 'DreamShaper XL',
|
|
@@ -225,29 +225,16 @@ with gr.Blocks(css=css, theme=theme, fill_width= False) as app:
|
|
| 225 |
with gr.Row():
|
| 226 |
seed = gr.Number(show_label=True, label="Seed:", minimum=-1, maximum=1000000, value=-1, step=1)
|
| 227 |
|
| 228 |
-
with gr.Tab("Upscaling Settings"):
|
| 229 |
-
with gr.Column():
|
| 230 |
-
with gr.Row():
|
| 231 |
-
scale_by = gr.Number(show_label=True, label="How many times to increase:", minimum=1, maximum=2, value=2, step=1)
|
| 232 |
-
with gr.Row():
|
| 233 |
-
method = gr.Dropdown(show_label=True, value="ESRGAN_4x", label="Algorithm of enlargement", choices=["ScuNET GAN", "SwinIR 4x", "ESRGAN_4x", "R-ESRGAN 4x+", "R-ESRGAN 4x+ Anime6B"])
|
| 234 |
-
with gr.Column():
|
| 235 |
-
with gr.Row():
|
| 236 |
-
gfpgan = gr.Slider(show_label=True, label="Effect GFPGAN (to improve the face)", minimum=0, maximum=1, value=0, step=0.1)
|
| 237 |
-
with gr.Row():
|
| 238 |
-
codeformer = gr.Slider(show_label=True, label="Effect CodeFormer (to improve the face)", minimum=0, maximum=1, value=0, step=0.1)
|
| 239 |
-
|
| 240 |
with gr.Column():
|
| 241 |
text_button = gr.Button("Generate image", variant='primary', elem_id="generate")
|
| 242 |
with gr.Column():
|
| 243 |
image_output = gr.Image(show_download_button=True, interactive=False, label='Generated Image 🌄', show_share_button=False, show_fullscreen_button=True, format="png", elem_id="gallery")
|
| 244 |
text_button.click(flip_text, inputs=[prompt, negative_prompt, task, steps, sampler, cfg_scale, seed], outputs=image_output, concurrency_limit=48)
|
|
|
|
|
|
|
| 245 |
|
| 246 |
-
img2img_b = gr.Button("Increase the image", variant='secondary')
|
| 247 |
-
image_i2i = gr.Image(show_label=True, label='Increased image:')
|
| 248 |
-
img2img_b.click(mirror, inputs=[image_output, scale_by, method, gfpgan, codeformer], outputs=image_i2i, concurrency_limit=48)
|
| 249 |
-
|
| 250 |
|
|
|
|
| 251 |
if __name__ == "__main__":
|
| 252 |
app.launch(show_api=False, share=False)
|
| 253 |
|
|
|
|
| 201 |
|
| 202 |
with gr.Tab("Basic Settings"):
|
| 203 |
with gr.Row():
|
| 204 |
+
prompt = gr.Textbox(placeholder="Enter the image description...", show_label=True, label='Image Prompt ✍️', lines=3, scale=6, show_copy_button = True)
|
| 205 |
with gr.Row():
|
| 206 |
task = gr.Radio(interactive=True, value="Stable Diffusion XL 1.0", show_label=True, label="Model of neural network:", choices=['Stable Diffusion XL 1.0', 'Crystal Clear XL',
|
| 207 |
'Juggernaut XL', 'DreamShaper XL',
|
|
|
|
| 225 |
with gr.Row():
|
| 226 |
seed = gr.Number(show_label=True, label="Seed:", minimum=-1, maximum=1000000, value=-1, step=1)
|
| 227 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 228 |
with gr.Column():
|
| 229 |
text_button = gr.Button("Generate image", variant='primary', elem_id="generate")
|
| 230 |
with gr.Column():
|
| 231 |
image_output = gr.Image(show_download_button=True, interactive=False, label='Generated Image 🌄', show_share_button=False, show_fullscreen_button=True, format="png", elem_id="gallery")
|
| 232 |
text_button.click(flip_text, inputs=[prompt, negative_prompt, task, steps, sampler, cfg_scale, seed], outputs=image_output, concurrency_limit=48)
|
| 233 |
+
clear_prompt =gr.Button("Clear 🗑️",variant="primary", elem_id="clear_button")
|
| 234 |
+
clear_prompt.click(lambda: (None, None), None, [prompt, image_output], queue=False, show_api=False)
|
| 235 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 236 |
|
| 237 |
+
iapp.queue(default_concurrency_limit=200, max_size=200) # <-- Sets up a queue with default parameters
|
| 238 |
if __name__ == "__main__":
|
| 239 |
app.launch(show_api=False, share=False)
|
| 240 |
|