Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -450,91 +450,44 @@ with gr.Blocks(css="style.css") as demo:
|
|
| 450 |
# invert_button = gr.Button("⏪ Invert")
|
| 451 |
with gr.Column():
|
| 452 |
image_slider = ImageSlider(position=0.5, type="pil", height=512, width=512)
|
| 453 |
-
# gallery1 = gr.Image(label="Identity from Original Model",height=512, width=512, interactive=False)
|
| 454 |
|
| 455 |
-
|
| 456 |
-
|
| 457 |
-
|
| 458 |
-
|
| 459 |
-
|
| 460 |
-
# Editing
|
| 461 |
-
with gr.Column():
|
| 462 |
-
#gallery2 = gr.Image(label="Identity from Edited Model", interactive=False, visible=False )
|
| 463 |
-
with gr.Row():
|
| 464 |
-
a1 = gr.Slider(label="- Young +", value=0, step=0.001, minimum=-1, maximum=1, interactive=True)
|
| 465 |
-
a2 = gr.Slider(label="- Pointy Nose +", value=0, step=0.001, minimum=-1, maximum=1, interactive=True)
|
| 466 |
-
with gr.Row():
|
| 467 |
-
a3 = gr.Slider(label="- Curly Hair +", value=0, step=0.001, minimum=-1, maximum=1, interactive=True)
|
| 468 |
-
a4 = gr.Slider(label="- Thick Eyebrows +", value=0, step=0.001, minimum=-1, maximum=1, interactive=True)
|
| 469 |
-
# prompt2 = gr.Textbox(label="Prompt",
|
| 470 |
-
# info="Make sure to include 'sks person'" ,
|
| 471 |
-
# placeholder="sks person",
|
| 472 |
-
# value="sks person", visible=False)
|
| 473 |
-
# seed2 = gr.Number(value=5, label="Seed", precision=0, interactive=True, visible=False)
|
| 474 |
-
|
| 475 |
|
|
|
|
|
|
|
| 476 |
|
| 477 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 478 |
|
| 479 |
|
| 480 |
|
| 481 |
-
|
| 482 |
-
|
| 483 |
-
|
| 484 |
-
|
| 485 |
-
|
| 486 |
-
with gr.Row():
|
| 487 |
-
epochs = gr.Slider(label="Epochs", value=400, step=1, minimum=1, maximum=2000, interactive=True)
|
| 488 |
-
weight_decay = gr.Number(value=1e-10, label="Weight Decay", interactive=True)
|
| 489 |
-
with gr.Tab("Sampling"):
|
| 490 |
-
with gr.Row():
|
| 491 |
-
cfg1= gr.Slider(label="CFG", value=3.0, step=0.1, minimum=0, maximum=10, interactive=True)
|
| 492 |
-
steps1 = gr.Slider(label="Inference Steps", value=50, step=1, minimum=0, maximum=100, interactive=True)
|
| 493 |
-
seed1 = gr.Number(value=5, label="Seed", precision=0, interactive=True)
|
| 494 |
-
with gr.Row():
|
| 495 |
-
negative_prompt1 = gr.Textbox(label="Negative Prompt", placeholder="low quality, blurry, unfinished, nudity, weapon", value="low quality, blurry, unfinished, nudity, weapon")
|
| 496 |
-
injection_step = gr.Slider(label="Injection Step", value=800, step=1, minimum=0, maximum=1000, interactive=True)
|
| 497 |
|
| 498 |
|
| 499 |
-
|
| 500 |
-
# with gr.Column():
|
| 501 |
-
# cfg2 = gr.Slider(label="CFG", value=3.0, step=0.1, minimum=0, maximum=10, interactive=True)
|
| 502 |
-
# steps2 = gr.Slider(label="Inference Steps", value=50, step=1, minimum=0, maximum=100, interactive=True)
|
| 503 |
-
# injection_step = gr.Slider(label="Injection Step", value=800, step=1, minimum=0, maximum=1000, interactive=True)
|
| 504 |
-
# negative_prompt2 = gr.Textbox(label="Negative Prompt", placeholder="low quality, blurry, unfinished, nudity, weapon", value="low quality, blurry, unfinished, nudity, weapon")
|
| 505 |
-
with gr.Tab("Uploading a model"):
|
| 506 |
-
gr.Markdown("""<div style="text-align: justify;">Upload a model below downloaded from this demo.""")
|
| 507 |
-
|
| 508 |
-
file_input = gr.File(label="Upload Model", container=True)
|
| 509 |
|
| 510 |
submit1 = gr.Button("Generate")
|
| 511 |
|
| 512 |
|
| 513 |
|
| 514 |
-
|
| 515 |
-
|
| 516 |
-
# with gr.Row():
|
| 517 |
-
# file_output = gr.File(label="Download Sampled Model", container=True, interactive=False)
|
| 518 |
-
|
| 519 |
-
|
| 520 |
-
|
| 521 |
-
|
| 522 |
-
|
| 523 |
-
# invert_button.click(fn=run_inversion,
|
| 524 |
-
# inputs=[input_image, pcs, epochs, weight_decay,lr],
|
| 525 |
-
# outputs = [image_slider, file_output])
|
| 526 |
-
|
| 527 |
|
| 528 |
sample.click(fn=sample_then_run, outputs=[image_slider, file_output])
|
| 529 |
|
| 530 |
-
|
| 531 |
-
|
| 532 |
-
# outputs=gallery1)
|
| 533 |
-
# submit1.click(fn=edit_inference,
|
| 534 |
-
# inputs=[input_image, prompt1, negative_prompt1, cfg1, steps1, seed1, injection_step, a1, a2, a3, a4],
|
| 535 |
-
# outputs=image_slider)
|
| 536 |
-
submit1.click(
|
| 537 |
-
fn=edit_inference, inputs=[ prompt1, negative_prompt1, cfg1, steps1, seed1, injection_step, a1, a2, a3, a4], outputs=image_slider)
|
| 538 |
file_input.change(fn=file_upload, inputs=file_input, outputs = image_slider)
|
| 539 |
|
| 540 |
|
|
|
|
| 450 |
# invert_button = gr.Button("⏪ Invert")
|
| 451 |
with gr.Column():
|
| 452 |
image_slider = ImageSlider(position=0.5, type="pil", height=512, width=512)
|
|
|
|
| 453 |
|
| 454 |
+
prompt1 = gr.Textbox(label="Prompt",
|
| 455 |
+
info="Make sure to include 'sks person'" ,
|
| 456 |
+
placeholder="sks person",
|
| 457 |
+
value="sks person")
|
| 458 |
+
seed1 = gr.Number(value=5, label="Seed", precision=0, interactive=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 459 |
|
| 460 |
+
|
| 461 |
+
|
| 462 |
|
| 463 |
+
with gr.Row():
|
| 464 |
+
a1 = gr.Slider(label="- Young +", value=0, step=0.001, minimum=-1, maximum=1, interactive=True)
|
| 465 |
+
a2 = gr.Slider(label="- Pointy Nose +", value=0, step=0.001, minimum=-1, maximum=1, interactive=True)
|
| 466 |
+
with gr.Row():
|
| 467 |
+
a3 = gr.Slider(label="- Curly Hair +", value=0, step=0.001, minimum=-1, maximum=1, interactive=True)
|
| 468 |
+
a4 = gr.Slider(label="- Thick Eyebrows +", value=0, step=0.001, minimum=-1, maximum=1, interactive=True)
|
| 469 |
|
| 470 |
|
| 471 |
|
| 472 |
+
with gr.Accordion("Advanced Options", open=False):
|
| 473 |
+
cfg1= gr.Slider(label="CFG", value=3.0, step=0.1, minimum=0, maximum=10, interactive=True)
|
| 474 |
+
steps1 = gr.Slider(label="Inference Steps", value=50, step=1, minimum=0, maximum=100, interactive=True)
|
| 475 |
+
negative_prompt1 = gr.Textbox(label="Negative Prompt", placeholder="low quality, blurry, unfinished, nudity, weapon", value="low quality, blurry, unfinished, nudity, weapon")
|
| 476 |
+
injection_step = gr.Slider(label="Injection Step", value=800, step=1, minimum=0, maximum=1000, interactive=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 477 |
|
| 478 |
|
| 479 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 480 |
|
| 481 |
submit1 = gr.Button("Generate")
|
| 482 |
|
| 483 |
|
| 484 |
|
| 485 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 486 |
|
| 487 |
sample.click(fn=sample_then_run, outputs=[image_slider, file_output])
|
| 488 |
|
| 489 |
+
|
| 490 |
+
submit1.click(fn=edit_inference, inputs=[ prompt1, negative_prompt1, cfg1, steps1, seed1, injection_step, a1, a2, a3, a4], outputs=image_slider)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 491 |
file_input.change(fn=file_upload, inputs=file_input, outputs = image_slider)
|
| 492 |
|
| 493 |
|