Update app.py
Browse files
app.py
CHANGED
@@ -39,6 +39,8 @@ inference_timeout = 400
|
|
39 |
default_models = models[:num_models]
|
40 |
MAX_SEED = 2**32-1
|
41 |
|
|
|
|
|
42 |
|
43 |
def extend_choices(choices):
|
44 |
return choices[:num_models] + (num_models - len(choices[:num_models])) * ['NA']
|
@@ -87,7 +89,7 @@ async def infer(model_str, prompt, nprompt="", height=0, width=0, steps=0, cfg=0
|
|
87 |
if task.done() and result is not None and not isinstance(result, tuple):
|
88 |
with lock:
|
89 |
png_path = model_str.replace("/", "_") + " - " + get_current_time() + "_" + str(theSeed) + ".png"
|
90 |
-
lnk_output
|
91 |
image = save_image(result, png_path, model_str, prompt, nprompt, height, width, steps, cfg, theSeed)
|
92 |
return image
|
93 |
return None
|
@@ -195,7 +197,7 @@ with gr.Blocks(head=CSS + JS) as demo:
|
|
195 |
with gr.Column(scale=2):
|
196 |
with gr.Group():
|
197 |
txt_input = gr.Textbox(label='Your prompt:', value=preSetPrompt, lines=3, autofocus=1)
|
198 |
-
lnk_output = gr.Textbox(
|
199 |
neg_input = gr.Textbox(label='Negative prompt:', value=negPreSetPrompt, lines=1)
|
200 |
with gr.Accordion("Advanced", open=False, visible=True):
|
201 |
with gr.Row():
|
@@ -214,20 +216,15 @@ with gr.Blocks(head=CSS + JS) as demo:
|
|
214 |
with gr.Column(scale=1):
|
215 |
with gr.Group():
|
216 |
with gr.Row():
|
217 |
-
output = [gr.Image(label=m, show_download_button=True, elem_classes=["image-monitor"],
|
218 |
-
|
219 |
-
visible=True) for m in default_models]
|
220 |
current_models = [gr.Textbox(m, visible=False) for m in default_models]
|
221 |
|
222 |
with gr.Column(scale=2):
|
223 |
-
gallery = gr.Gallery(label="Output", show_download_button=True,
|
224 |
-
interactive=False, show_share_button=False, container=True, format="png",
|
225 |
-
preview=True, object_fit="cover", columns=2, rows=2)
|
226 |
|
227 |
for m, o in zip(current_models, output):
|
228 |
-
gen_event = gr.on(triggers=[gen_button.click, txt_input.submit], fn=gen_fn,
|
229 |
-
inputs=[m, txt_input, neg_input, height, width, steps, cfg, seed], outputs=[o],
|
230 |
-
concurrency_limit=None, queue=False)
|
231 |
o.change(add_gallery, [o, m, gallery], [gallery])
|
232 |
|
233 |
with gr.Column(scale=4):
|
|
|
39 |
default_models = models[:num_models]
|
40 |
MAX_SEED = 2**32-1
|
41 |
|
42 |
+
def imgageHasUpdated(theImage):
|
43 |
+
print("Check")
|
44 |
|
45 |
def extend_choices(choices):
|
46 |
return choices[:num_models] + (num_models - len(choices[:num_models])) * ['NA']
|
|
|
89 |
if task.done() and result is not None and not isinstance(result, tuple):
|
90 |
with lock:
|
91 |
png_path = model_str.replace("/", "_") + " - " + get_current_time() + "_" + str(theSeed) + ".png"
|
92 |
+
lnk_output(value=png_path)
|
93 |
image = save_image(result, png_path, model_str, prompt, nprompt, height, width, steps, cfg, theSeed)
|
94 |
return image
|
95 |
return None
|
|
|
197 |
with gr.Column(scale=2):
|
198 |
with gr.Group():
|
199 |
txt_input = gr.Textbox(label='Your prompt:', value=preSetPrompt, lines=3, autofocus=1)
|
200 |
+
lnk_output = gr.Textbox(label='The Link:',visible=True,interactive=False,elem_id="LnkBox")
|
201 |
neg_input = gr.Textbox(label='Negative prompt:', value=negPreSetPrompt, lines=1)
|
202 |
with gr.Accordion("Advanced", open=False, visible=True):
|
203 |
with gr.Row():
|
|
|
216 |
with gr.Column(scale=1):
|
217 |
with gr.Group():
|
218 |
with gr.Row():
|
219 |
+
output = [gr.Image(label=m, show_download_button=True, elem_classes=["image-monitor"], interactive=False, width=112, height=112, show_share_button=False, format="png", visible=True) for m in default_models]
|
220 |
+
output.change(imgageHasUpdated)
|
|
|
221 |
current_models = [gr.Textbox(m, visible=False) for m in default_models]
|
222 |
|
223 |
with gr.Column(scale=2):
|
224 |
+
gallery = gr.Gallery(label="Output", show_download_button=True,interactive=False, show_share_button=False, container=True, format="png", preview=True, object_fit="cover", columns=2, rows=2)
|
|
|
|
|
225 |
|
226 |
for m, o in zip(current_models, output):
|
227 |
+
gen_event = gr.on(triggers=[gen_button.click, txt_input.submit], fn=gen_fn,inputs=[m, txt_input, neg_input, height, width, steps, cfg, seed], outputs=[o], concurrency_limit=None, queue=False)
|
|
|
|
|
228 |
o.change(add_gallery, [o, m, gallery], [gallery])
|
229 |
|
230 |
with gr.Column(scale=4):
|