Spaces:
Running
on
Zero
Running
on
Zero
amildravid4292
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -418,18 +418,14 @@ def file_upload(file):
|
|
418 |
|
419 |
|
420 |
|
421 |
-
|
422 |
-
# <h1 style="margin-left: 12px;text-align: center;margin-bottom: 7px;display: inline-block">weights2weights</h1>
|
423 |
-
# <h3 style="display: inline-block;margin-left: 10px;margin-top: 6px;font-weight: 500">Interpreting the Weight Space of Customized Diffusion Models</h3>
|
424 |
-
|
425 |
-
|
426 |
intro = """
|
427 |
<div style="display: flex;align-items: center;justify-content: center">
|
428 |
-
<
|
429 |
</div>
|
430 |
<p style="font-size: 0.95rem;margin: 0rem;line-height: 1.2em;margin-top:1em;display: inline-block">
|
431 |
-
<a href="https://snap-research.github.io/weights2weights/" target="_blank">
|
432 |
|
|
|
|
433 |
<a href="https://huggingface.co/spaces/Snapchat/w2w-demo?duplicate=true" target="_blank" style="
|
434 |
display: inline-block;
|
435 |
">
|
@@ -443,9 +439,7 @@ with gr.Blocks(css="style.css") as demo:
|
|
443 |
gr.HTML(intro)
|
444 |
with gr.Tab("Model Editing"):
|
445 |
gr.Markdown("""
|
446 |
-
Click
|
447 |
-
> 💡 When inverting, draw a mask over the face for improved results.
|
448 |
-
> To use a model previously downloaded from this demo see `Uplaoding a model` in the `Advanced options`
|
449 |
""")
|
450 |
with gr.Column():
|
451 |
with gr.Row():
|
@@ -456,7 +450,7 @@ with gr.Blocks(css="style.css") as demo:
|
|
456 |
|
457 |
|
458 |
with gr.Column():
|
459 |
-
image_slider1 = ImageSlider(position=0.5, type="pil", height=512, width=512)
|
460 |
|
461 |
prompt1 = gr.Textbox(label="Prompt",
|
462 |
info="Make sure to include 'sks person'" ,
|
@@ -488,6 +482,9 @@ with gr.Blocks(css="style.css") as demo:
|
|
488 |
submit1 = gr.Button("Generate")
|
489 |
|
490 |
with gr.Tab("Inversion"):
|
|
|
|
|
|
|
491 |
with gr.Row():
|
492 |
with gr.Column():
|
493 |
input_image = gr.ImageEditor(elem_id="image_upload", type='pil', label="Upload image and draw to define mask", height=512, width=512, brush=gr.Brush(), layers=False)
|
@@ -499,7 +496,7 @@ with gr.Blocks(css="style.css") as demo:
|
|
499 |
file_output2 = gr.File(label="Download Inverted Model", container=True, interactive=False)
|
500 |
|
501 |
with gr.Column():
|
502 |
-
image_slider2 = ImageSlider(position=0.5, type="pil", height=512, width=512)
|
503 |
|
504 |
prompt2 = gr.Textbox(label="Prompt",
|
505 |
info="Make sure to include 'sks person'" ,
|
@@ -529,9 +526,8 @@ with gr.Blocks(css="style.css") as demo:
|
|
529 |
|
530 |
|
531 |
submit2 = gr.Button("Generate")
|
532 |
-
|
533 |
-
|
534 |
|
|
|
535 |
|
536 |
|
537 |
|
@@ -549,5 +545,9 @@ with gr.Blocks(css="style.css") as demo:
|
|
549 |
submit2.click(fn=edit_inference, inputs=[ prompt2, negative_prompt2, cfg2, steps2, seed2, injection_step2, a1_2, a2_2, a3_2, a4_2], outputs=image_slider2)
|
550 |
|
551 |
|
|
|
|
|
|
|
|
|
552 |
|
553 |
demo.queue().launch()
|
|
|
418 |
|
419 |
|
420 |
|
|
|
|
|
|
|
|
|
|
|
421 |
intro = """
|
422 |
<div style="display: flex;align-items: center;justify-content: center">
|
423 |
+
<h2 style="display: inline-block;margin-left: 10px;margin-top: 6px;font-weight: 500">Interpreting the Weight Space of Customized Diffusion Models (aka <b> <em>weights2weights</em></b>)</h2>
|
424 |
</div>
|
425 |
<p style="font-size: 0.95rem;margin: 0rem;line-height: 1.2em;margin-top:1em;display: inline-block">
|
426 |
+
<a href="https://snap-research.github.io/weights2weights/" target="_blank">Project Page</a> | <a href="https://arxiv.org/abs/2406.09413" target="_blank">Paper</a>
|
427 |
|
|
428 |
+
<a href="https://github.com/snap-research/weights2weights" target="_blank">Code</a> |
|
429 |
<a href="https://huggingface.co/spaces/Snapchat/w2w-demo?duplicate=true" target="_blank" style="
|
430 |
display: inline-block;
|
431 |
">
|
|
|
439 |
gr.HTML(intro)
|
440 |
with gr.Tab("Model Editing"):
|
441 |
gr.Markdown("""
|
442 |
+
Click the `Sample New Model` to sample a new identity-encoding model or upload a model to get started ✨
|
|
|
|
|
443 |
""")
|
444 |
with gr.Column():
|
445 |
with gr.Row():
|
|
|
450 |
|
451 |
|
452 |
with gr.Column():
|
453 |
+
image_slider1 = ImageSlider(position=0.5, type="pil", height=512, width=512, label= "Reference Identity | Generated Samples by User")
|
454 |
|
455 |
prompt1 = gr.Textbox(label="Prompt",
|
456 |
info="Make sure to include 'sks person'" ,
|
|
|
482 |
submit1 = gr.Button("Generate")
|
483 |
|
484 |
with gr.Tab("Inversion"):
|
485 |
+
gr.Markdown("""
|
486 |
+
Upload an image and optionally define a mask by drawing over the face. Then click `invert` to get started ✨
|
487 |
+
""")
|
488 |
with gr.Row():
|
489 |
with gr.Column():
|
490 |
input_image = gr.ImageEditor(elem_id="image_upload", type='pil', label="Upload image and draw to define mask", height=512, width=512, brush=gr.Brush(), layers=False)
|
|
|
496 |
file_output2 = gr.File(label="Download Inverted Model", container=True, interactive=False)
|
497 |
|
498 |
with gr.Column():
|
499 |
+
image_slider2 = ImageSlider(position=0.5, type="pil", height=512, width=512, label= "Reference Identity | Generated Samples by User")
|
500 |
|
501 |
prompt2 = gr.Textbox(label="Prompt",
|
502 |
info="Make sure to include 'sks person'" ,
|
|
|
526 |
|
527 |
|
528 |
submit2 = gr.Button("Generate")
|
|
|
|
|
529 |
|
530 |
+
|
531 |
|
532 |
|
533 |
|
|
|
545 |
submit2.click(fn=edit_inference, inputs=[ prompt2, negative_prompt2, cfg2, steps2, seed2, injection_step2, a1_2, a2_2, a3_2, a4_2], outputs=image_slider2)
|
546 |
|
547 |
|
548 |
+
|
549 |
+
|
550 |
+
|
551 |
+
|
552 |
|
553 |
demo.queue().launch()
|