Spaces:
Running
on
Zero
Running
on
Zero
add examples (#3)
Browse files- Upload 8 files (9b6844a2a61f8eedf7509d8fa2077501fb7352ea)
- Update app.py (abd3b00d363f6c8f7cda2c601e658f3e49466db7)
Co-authored-by: Linoy Tsaban <[email protected]>
- .gitattributes +5 -0
- app.py +20 -1
- examples 2/celeb_meme.jpg +3 -0
- examples 2/cookie.png +3 -0
- examples 2/ghibli_meme.jpg +0 -0
- examples 2/leather.jpg +3 -0
- examples 2/meme.jpg +0 -0
- examples 2/no_cookie.png +3 -0
- examples 2/poster.jpg +0 -0
- examples 2/poster_orig.jpg +3 -0
.gitattributes
CHANGED
|
@@ -33,3 +33,8 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
+
examples[[:space:]]2/celeb_meme.jpg filter=lfs diff=lfs merge=lfs -text
|
| 37 |
+
examples[[:space:]]2/cookie.png filter=lfs diff=lfs merge=lfs -text
|
| 38 |
+
examples[[:space:]]2/leather.jpg filter=lfs diff=lfs merge=lfs -text
|
| 39 |
+
examples[[:space:]]2/no_cookie.png filter=lfs diff=lfs merge=lfs -text
|
| 40 |
+
examples[[:space:]]2/poster_orig.jpg filter=lfs diff=lfs merge=lfs -text
|
app.py
CHANGED
|
@@ -26,6 +26,17 @@ from modules.model_edit import Step1XParams, Step1XEdit
|
|
| 26 |
|
| 27 |
print("TORCH_CUDA", torch.cuda.is_available())
|
| 28 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29 |
def load_state_dict(model, ckpt_path, device="cuda", strict=False, assign=True):
|
| 30 |
if Path(ckpt_path).suffix == ".safetensors":
|
| 31 |
state_dict = load_file(ckpt_path, device)
|
|
@@ -444,7 +455,7 @@ with gr.Blocks() as demo:
|
|
| 444 |
with gr.Row():
|
| 445 |
with gr.Column():
|
| 446 |
prompt = gr.Textbox(
|
| 447 |
-
label="缂栬緫鎸囦护",
|
| 448 |
value='Remove the person from the image.',
|
| 449 |
)
|
| 450 |
init_image = gr.Image(label="Input Image", type='pil')
|
|
@@ -470,4 +481,12 @@ with gr.Blocks() as demo:
|
|
| 470 |
outputs=[output_image, output_random_seed],
|
| 471 |
)
|
| 472 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 473 |
demo.launch()
|
|
|
|
| 26 |
|
| 27 |
print("TORCH_CUDA", torch.cuda.is_available())
|
| 28 |
|
| 29 |
+
examples = [
|
| 30 |
+
["examples 2/meme.jpg", "turn into an illustration in studio ghibli style",("examples 2/meme.jpg","examples 2/ghibli_meme.jpg"),],
|
| 31 |
+
["examples 2/celeb_meme.jpg", "replace the gray blazer with a leather jacket",("examples 2/celeb_meme.jpg","examples 2/leather.jpg")],
|
| 32 |
+
["examples 2/cookie.png", "remove the cookie",("examples 2/cookie.png","examples 2/no_cookie.png")],
|
| 33 |
+
["examples 2/poster_orig.jpg", "replace 'lambs' with 'llamas'",("examples 2/poster_orig.jpg","examples 2/poster.jpg")],
|
| 34 |
+
]
|
| 35 |
+
|
| 36 |
+
def generate_examples(init_image, output_image, prompt):
|
| 37 |
+
return init_image, output_image, prompt
|
| 38 |
+
|
| 39 |
+
|
| 40 |
def load_state_dict(model, ckpt_path, device="cuda", strict=False, assign=True):
|
| 41 |
if Path(ckpt_path).suffix == ".safetensors":
|
| 42 |
state_dict = load_file(ckpt_path, device)
|
|
|
|
| 455 |
with gr.Row():
|
| 456 |
with gr.Column():
|
| 457 |
prompt = gr.Textbox(
|
| 458 |
+
label="缂栬緫鎸囦护 prompt",
|
| 459 |
value='Remove the person from the image.',
|
| 460 |
)
|
| 461 |
init_image = gr.Image(label="Input Image", type='pil')
|
|
|
|
| 481 |
outputs=[output_image, output_random_seed],
|
| 482 |
)
|
| 483 |
|
| 484 |
+
gr.Examples(
|
| 485 |
+
examples,
|
| 486 |
+
inputs=[init_image, prompt, output_image],
|
| 487 |
+
outputs=[init_image, prompt, output_image],
|
| 488 |
+
fn=generate_examples,
|
| 489 |
+
cache_examples=False
|
| 490 |
+
)
|
| 491 |
+
|
| 492 |
demo.launch()
|
examples 2/celeb_meme.jpg
ADDED
|
Git LFS Details
|
examples 2/cookie.png
ADDED
|
Git LFS Details
|
examples 2/ghibli_meme.jpg
ADDED
|
examples 2/leather.jpg
ADDED
|
Git LFS Details
|
examples 2/meme.jpg
ADDED
|
examples 2/no_cookie.png
ADDED
|
Git LFS Details
|
examples 2/poster.jpg
ADDED
|
examples 2/poster_orig.jpg
ADDED
|
Git LFS Details
|