Update app.py
Browse files
app.py
CHANGED
|
@@ -39,10 +39,6 @@ inference_timeout = 400
|
|
| 39 |
default_models = models[:num_models]
|
| 40 |
MAX_SEED = 2**32-1
|
| 41 |
|
| 42 |
-
def imgageHasUpdated(theImage):
|
| 43 |
-
print(theImage)
|
| 44 |
-
# outputs=lnk_output
|
| 45 |
-
|
| 46 |
def extend_choices(choices):
|
| 47 |
return choices[:num_models] + (num_models - len(choices[:num_models])) * ['NA']
|
| 48 |
|
|
@@ -234,7 +230,6 @@ with gr.Blocks(head=CSS + JS) as demo:
|
|
| 234 |
with gr.Column(scale=2):
|
| 235 |
with gr.Group():
|
| 236 |
txt_input = gr.Textbox(label='Your prompt:', value=preSetPrompt, lines=3, autofocus=1)
|
| 237 |
-
lnk_output = gr.Textbox(label='The Link:',visible=True,interactive=False,elem_id="LnkBox")
|
| 238 |
neg_input = gr.Textbox(label='Negative prompt:', value=negPreSetPrompt, lines=1)
|
| 239 |
with gr.Accordion("Advanced", open=False, visible=True):
|
| 240 |
with gr.Row():
|
|
@@ -247,24 +242,15 @@ with gr.Blocks(head=CSS + JS) as demo:
|
|
| 247 |
seed_rand = gr.Button("Randomize Seed 🎲", size="sm", variant="secondary")
|
| 248 |
seed_rand.click(randomize_seed, None, [seed], queue=False)
|
| 249 |
with gr.Row():
|
| 250 |
-
gen_button = gr.Button(f'Generate up to {int(num_models)} images', variant='primary', scale=3,
|
| 251 |
random_button = gr.Button(f'Randomize Models', variant='secondary', scale=1)
|
| 252 |
|
| 253 |
with gr.Column(scale=1):
|
| 254 |
with gr.Group():
|
| 255 |
with gr.Row():
|
| 256 |
-
output = [gr.Image(label=m, show_download_button=True,
|
| 257 |
-
imgageHasUpdated(output)
|
| 258 |
current_models = [gr.Textbox(m, visible=False) for m in default_models]
|
| 259 |
|
| 260 |
-
with gr.Column(scale=2):
|
| 261 |
-
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)
|
| 262 |
-
|
| 263 |
-
for m, o in zip(current_models, output):
|
| 264 |
-
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)
|
| 265 |
-
o.change(add_gallery, [o, m, gallery], [gallery])
|
| 266 |
-
# o.change(imgageHasUpdated,[o])
|
| 267 |
-
|
| 268 |
with gr.Column(scale=4):
|
| 269 |
with gr.Accordion('Model selection'):
|
| 270 |
model_choice = gr.CheckboxGroup(models, label = f'Choose up to {int(num_models)} different models from the {len(models)} available!', value=default_models, interactive=True)
|
|
|
|
| 39 |
default_models = models[:num_models]
|
| 40 |
MAX_SEED = 2**32-1
|
| 41 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 42 |
def extend_choices(choices):
|
| 43 |
return choices[:num_models] + (num_models - len(choices[:num_models])) * ['NA']
|
| 44 |
|
|
|
|
| 230 |
with gr.Column(scale=2):
|
| 231 |
with gr.Group():
|
| 232 |
txt_input = gr.Textbox(label='Your prompt:', value=preSetPrompt, lines=3, autofocus=1)
|
|
|
|
| 233 |
neg_input = gr.Textbox(label='Negative prompt:', value=negPreSetPrompt, lines=1)
|
| 234 |
with gr.Accordion("Advanced", open=False, visible=True):
|
| 235 |
with gr.Row():
|
|
|
|
| 242 |
seed_rand = gr.Button("Randomize Seed 🎲", size="sm", variant="secondary")
|
| 243 |
seed_rand.click(randomize_seed, None, [seed], queue=False)
|
| 244 |
with gr.Row():
|
| 245 |
+
gen_button = gr.Button(f'Generate up to {int(num_models)} images', variant='primary', scale=3, elem_id=["theButt"])
|
| 246 |
random_button = gr.Button(f'Randomize Models', variant='secondary', scale=1)
|
| 247 |
|
| 248 |
with gr.Column(scale=1):
|
| 249 |
with gr.Group():
|
| 250 |
with gr.Row():
|
| 251 |
+
output = [gr.Image(label=m, show_download_button=True, interactive=False, width=112, height=112, show_share_button=False, format="png", visible=True) for m in default_models]
|
|
|
|
| 252 |
current_models = [gr.Textbox(m, visible=False) for m in default_models]
|
| 253 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 254 |
with gr.Column(scale=4):
|
| 255 |
with gr.Accordion('Model selection'):
|
| 256 |
model_choice = gr.CheckboxGroup(models, label = f'Choose up to {int(num_models)} different models from the {len(models)} available!', value=default_models, interactive=True)
|