Update app.py
Browse files
app.py
CHANGED
@@ -21,7 +21,7 @@ from fastapi import FastAPI
|
|
21 |
app = FastAPI()
|
22 |
|
23 |
|
24 |
-
def
|
25 |
result = {"prompt": prompt,"negative_prompt": negative_prompt,"task": task,"steps": steps,"sampler": sampler,"cfg_scale": cfg_scale,"seed": seed, "width": width, "height": height}
|
26 |
print(result)
|
27 |
try:
|
@@ -232,14 +232,17 @@ with gr.Blocks(css=css, theme=theme) as app:
|
|
232 |
with gr.Column():
|
233 |
text_button = gr.Button("Generate image", variant="primary", interactive=True, elem_id="generate")
|
234 |
with gr.Column():
|
235 |
-
image_output = gr.Image(show_download_button=True, interactive=False, label='Result:', show_share_button=False, format="png", elem_id="gallery")
|
236 |
-
|
|
|
|
|
|
|
237 |
|
238 |
img2img_b = gr.Button("Increase the image", variant='secondary')
|
239 |
image_i2i = gr.Image(show_label=True, label='Increased image:')
|
240 |
img2img_b.click(mirror, inputs=[image_output, scale_by, method, gfpgan, codeformer], outputs=image_i2i, concurrency_limit=48)
|
241 |
|
242 |
|
243 |
-
app.queue(default_concurrency_limit=200, max_size=200) # <-- Sets up a queue with default parameters
|
244 |
if __name__ == "__main__":
|
245 |
app.launch()
|
|
|
21 |
app = FastAPI()
|
22 |
|
23 |
|
24 |
+
def query(prompt, negative_prompt, task, steps, sampler, cfg_scale, seed, width=896, height=1152):
|
25 |
result = {"prompt": prompt,"negative_prompt": negative_prompt,"task": task,"steps": steps,"sampler": sampler,"cfg_scale": cfg_scale,"seed": seed, "width": width, "height": height}
|
26 |
print(result)
|
27 |
try:
|
|
|
232 |
with gr.Column():
|
233 |
text_button = gr.Button("Generate image", variant="primary", interactive=True, elem_id="generate")
|
234 |
with gr.Column():
|
235 |
+
image_output = gr.Image(show_download_button=True, interactive=False, label='Result:', show_share_button=False, format="png", type="filepath", elem_id="gallery")
|
236 |
+
|
237 |
+
text_button.click(query, inputs=[prompt, negative_prompt, task, steps, sampler, cfg_scale, seed, width, height], outputs=image_output, concurrency_limit=48)
|
238 |
+
clear_prompt =gr.Button("Clear 🗑️",variant="primary", elem_id="clear_button")
|
239 |
+
clear_prompt.click(lambda: (None, None), None, [prompt, image_output], queue=False, show_api=False)
|
240 |
|
241 |
img2img_b = gr.Button("Increase the image", variant='secondary')
|
242 |
image_i2i = gr.Image(show_label=True, label='Increased image:')
|
243 |
img2img_b.click(mirror, inputs=[image_output, scale_by, method, gfpgan, codeformer], outputs=image_i2i, concurrency_limit=48)
|
244 |
|
245 |
|
246 |
+
#app.queue(default_concurrency_limit=200, max_size=200) # <-- Sets up a queue with default parameters
|
247 |
if __name__ == "__main__":
|
248 |
app.launch()
|