Dhruv Diddi
commited on
Commit
·
82e3cad
1
Parent(s):
ca5c9f9
feat: update gradio interface
Browse files
app.py
CHANGED
@@ -239,8 +239,6 @@ examples = [
|
|
239 |
]
|
240 |
|
241 |
with gr.Blocks(css='style.css') as demo:
|
242 |
-
gr.Markdown(TITLE)
|
243 |
-
gr.Markdown(DESCRIPTION)
|
244 |
with gr.Box():
|
245 |
with gr.Row(elem_id='prompt-container').style(equal_height=True):
|
246 |
with gr.Column():
|
@@ -251,13 +249,6 @@ with gr.Blocks(css='style.css') as demo:
|
|
251 |
placeholder='Enter your prompt',
|
252 |
elem_id='prompt-text-input',
|
253 |
).style(container=False)
|
254 |
-
negative_prompt = gr.Text(
|
255 |
-
label='Negative prompt',
|
256 |
-
show_label=False,
|
257 |
-
max_lines=1,
|
258 |
-
placeholder='Enter a negative prompt',
|
259 |
-
elem_id='negative-prompt-text-input',
|
260 |
-
).style(container=False)
|
261 |
generate_button = gr.Button('Generate').style(full_width=False)
|
262 |
|
263 |
with gr.Column() as gallery_view:
|
@@ -283,12 +274,7 @@ with gr.Blocks(css='style.css') as demo:
|
|
283 |
interactive=False,
|
284 |
elem_id='upscaled-image').style(height=640)
|
285 |
back_to_selection_button = gr.Button('Back to selection')
|
286 |
-
|
287 |
-
community_icon = gr.HTML(community_icon_html)
|
288 |
-
loading_icon = gr.HTML(loading_icon_html)
|
289 |
-
share_button = gr.Button(
|
290 |
-
"Share to community", elem_id="share-btn")
|
291 |
-
share_button.click(None, [], [], _js=share_js)
|
292 |
with gr.Accordion('Advanced options',
|
293 |
open=False,
|
294 |
visible=SHOW_ADVANCED_OPTIONS):
|
@@ -399,12 +385,12 @@ with gr.Blocks(css='style.css') as demo:
|
|
399 |
gr.HTML(FOOTER)
|
400 |
stage1_inputs = [
|
401 |
prompt,
|
402 |
-
|
403 |
-
|
404 |
-
|
405 |
-
|
406 |
-
|
407 |
-
|
408 |
]
|
409 |
stage1_outputs = [
|
410 |
gallery,
|
@@ -455,49 +441,6 @@ with gr.Blocks(css='style.css') as demo:
|
|
455 |
queue=False,
|
456 |
)
|
457 |
|
458 |
-
negative_prompt.submit(
|
459 |
-
fn=randomize_seed_fn,
|
460 |
-
inputs=[seed_1, randomize_seed_1],
|
461 |
-
outputs=seed_1,
|
462 |
-
queue=False,
|
463 |
-
).then(
|
464 |
-
fn=lambda: -1,
|
465 |
-
outputs=selected_index_for_stage2,
|
466 |
-
queue=False,
|
467 |
-
).then(
|
468 |
-
fn=show_gallery_view,
|
469 |
-
outputs=[
|
470 |
-
gallery_view,
|
471 |
-
upscale_view,
|
472 |
-
],
|
473 |
-
queue=False,
|
474 |
-
).then(
|
475 |
-
fn=update_upscale_button,
|
476 |
-
inputs=selected_index_for_stage2,
|
477 |
-
outputs=[
|
478 |
-
upscale_button,
|
479 |
-
upscale_to_256_button,
|
480 |
-
],
|
481 |
-
queue=False,
|
482 |
-
).then(
|
483 |
-
fn=model.run_stage1,
|
484 |
-
inputs=stage1_inputs,
|
485 |
-
outputs=stage1_outputs,
|
486 |
-
).success(
|
487 |
-
fn=get_param_file_hash_name,
|
488 |
-
inputs=stage1_param_path,
|
489 |
-
outputs=stage1_param_file_hash_name,
|
490 |
-
queue=False,
|
491 |
-
).then(
|
492 |
-
fn=upload_stage1_result,
|
493 |
-
inputs=[
|
494 |
-
stage1_param_path,
|
495 |
-
stage1_result_path,
|
496 |
-
stage1_param_file_hash_name,
|
497 |
-
],
|
498 |
-
queue=False,
|
499 |
-
)
|
500 |
-
|
501 |
generate_button.click(
|
502 |
fn=randomize_seed_fn,
|
503 |
inputs=[seed_1, randomize_seed_1],
|
@@ -610,7 +553,7 @@ with gr.Blocks(css='style.css') as demo:
|
|
610 |
custom_timesteps_2,
|
611 |
num_inference_steps_2,
|
612 |
prompt,
|
613 |
-
|
614 |
seed_3,
|
615 |
guidance_scale_3,
|
616 |
num_inference_steps_3,
|
@@ -653,7 +596,7 @@ with gr.Blocks(css='style.css') as demo:
|
|
653 |
custom_timesteps_2,
|
654 |
num_inference_steps_2,
|
655 |
prompt,
|
656 |
-
|
657 |
seed_3,
|
658 |
guidance_scale_3,
|
659 |
num_inference_steps_3,
|
|
|
239 |
]
|
240 |
|
241 |
with gr.Blocks(css='style.css') as demo:
|
|
|
|
|
242 |
with gr.Box():
|
243 |
with gr.Row(elem_id='prompt-container').style(equal_height=True):
|
244 |
with gr.Column():
|
|
|
249 |
placeholder='Enter your prompt',
|
250 |
elem_id='prompt-text-input',
|
251 |
).style(container=False)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
252 |
generate_button = gr.Button('Generate').style(full_width=False)
|
253 |
|
254 |
with gr.Column() as gallery_view:
|
|
|
274 |
interactive=False,
|
275 |
elem_id='upscaled-image').style(height=640)
|
276 |
back_to_selection_button = gr.Button('Back to selection')
|
277 |
+
|
|
|
|
|
|
|
|
|
|
|
278 |
with gr.Accordion('Advanced options',
|
279 |
open=False,
|
280 |
visible=SHOW_ADVANCED_OPTIONS):
|
|
|
385 |
gr.HTML(FOOTER)
|
386 |
stage1_inputs = [
|
387 |
prompt,
|
388 |
+
"",
|
389 |
+
7,
|
390 |
+
2,
|
391 |
+
10,
|
392 |
+
"smart50",
|
393 |
+
25,
|
394 |
]
|
395 |
stage1_outputs = [
|
396 |
gallery,
|
|
|
441 |
queue=False,
|
442 |
)
|
443 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
444 |
generate_button.click(
|
445 |
fn=randomize_seed_fn,
|
446 |
inputs=[seed_1, randomize_seed_1],
|
|
|
553 |
custom_timesteps_2,
|
554 |
num_inference_steps_2,
|
555 |
prompt,
|
556 |
+
"",
|
557 |
seed_3,
|
558 |
guidance_scale_3,
|
559 |
num_inference_steps_3,
|
|
|
596 |
custom_timesteps_2,
|
597 |
num_inference_steps_2,
|
598 |
prompt,
|
599 |
+
"",
|
600 |
seed_3,
|
601 |
guidance_scale_3,
|
602 |
num_inference_steps_3,
|