Spaces:
Runtime error
Runtime error
jiayueru
commited on
Commit
β’
7352753
1
Parent(s):
e5db25f
Add app
Browse filesThis view is limited to 50 files because it contains too many changes. Β
See raw diff
- .gitignore +7 -0
- app.py +57 -0
- examples/layer/01_horse/00.jpg +0 -0
- examples/layer/01_horse/mask0.jpg +0 -0
- examples/layer/02_baby/00.jpg +0 -0
- examples/layer/02_baby/mask0.jpg +0 -0
- examples/layer/02_baby/mask1.jpg +0 -0
- examples/layer/02_baby/mask2.jpg +0 -0
- examples/layer/03_text/00.jpg +0 -0
- examples/layer/03_text/01.jpg +0 -0
- examples/layer/03_text/mask0.jpg +0 -0
- examples/layer/03_text/mask1.jpg +0 -0
- examples/layer/04_cross/0.jpg +0 -0
- examples/layer/04_cross/1.jpg +0 -0
- examples/layer/04_cross/2.jpg +0 -0
- examples/layer/04_cross/3.jpg +0 -0
- examples/layer/04_cross/mask0.jpg +0 -0
- examples/layer/04_cross/mask1.jpg +0 -0
- examples/layer/04_cross/mask2.jpg +0 -0
- examples/layer/04_cross/mask3.jpg +0 -0
- examples/moving/01_ball/0.jpg +0 -0
- examples/moving/01_ball/mask0.jpg +0 -0
- examples/moving/02_bell/0.jpg +0 -0
- examples/moving/02_bell/mask0.jpg +0 -0
- examples/pan/01.jpg +0 -0
- examples/pan/02.jpg +0 -0
- examples/pan/03.jpg +0 -0
- examples/pan/04.jpg +0 -0
- examples/pan/05.jpg +0 -0
- examples/pan/06.jpg +0 -0
- examples/remove/01_moto/0.jpg +0 -0
- examples/remove/01_moto/mask0.jpg +0 -0
- examples/remove/01_moto/mask1.jpg +0 -0
- examples/remove/02_ring/0.jpg +0 -0
- examples/remove/02_ring/mask0.jpg +0 -0
- examples/remove/02_ring/mask1.jpg +0 -0
- examples/remove/02_ring/mask2.jpg +0 -0
- examples/remove/03_ball/0.jpg +0 -0
- examples/remove/03_ball/mask0.jpg +0 -0
- examples/remove/03_ball/mask1.jpg +0 -0
- examples/remove/04_pikachu/0.jpg +0 -0
- examples/remove/04_pikachu/mask0.jpg +0 -0
- examples/remove/04_pikachu/mask1.jpg +0 -0
- examples/remove/04_pikachu/mask2.jpg +0 -0
- examples/remove/05_betty/0.jpg +0 -0
- examples/remove/05_betty/mask0.jpg +0 -0
- examples/zoom/01.jpg +0 -0
- examples/zoom/02.jpg +0 -0
- examples/zoom/03.jpg +0 -0
- examples/zoom/04.jpg +0 -0
.gitignore
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
img/
|
2 |
+
logfile/
|
3 |
+
__pycache__/
|
4 |
+
*/__pycache__/
|
5 |
+
models/
|
6 |
+
plt/
|
7 |
+
exp/
|
app.py
ADDED
@@ -0,0 +1,57 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import os
|
2 |
+
import subprocess
|
3 |
+
import shlex
|
4 |
+
from src.demo.model import DesignEdit
|
5 |
+
|
6 |
+
os.makedirs('models', exist_ok=True)
|
7 |
+
subprocess.run(shlex.split('wget https://huggingface.co/Adapter/DragonDiffusion/resolve/main/model/efficient_sam_vits.pt -O models/efficient_sam_vits.pt'))
|
8 |
+
|
9 |
+
from src.demo.demo import *
|
10 |
+
import shlex
|
11 |
+
|
12 |
+
import cv2
|
13 |
+
import gradio as gr
|
14 |
+
pretrained_model_path = "stabilityai/stable-diffusion-xl-base-1.0"
|
15 |
+
model = DesignEdit(pretrained_model_path=pretrained_model_path)
|
16 |
+
DESCRIPTION_1 = """<div style="text-align: center; font-size: 80px;">
|
17 |
+
<strong class="title is-1">
|
18 |
+
<span style="color: green;">πΏD</span>
|
19 |
+
<span style="color: orange;">e</span>
|
20 |
+
<span style="color: rgb(63, 185, 63);">s</span>
|
21 |
+
<span style="color: green;">i</span>
|
22 |
+
<span style="color: rgb(200, 85, 23);">g</span>
|
23 |
+
<span style="color: green;">n</span>
|
24 |
+
<span style="color: orange;">E</span>
|
25 |
+
<span style="color: crimson;">d</span>
|
26 |
+
<span style="color: darkorange;">i</span>
|
27 |
+
<span style="color: green;">tπΏ</span>
|
28 |
+
</strong>
|
29 |
+
</div>
|
30 |
+
"""
|
31 |
+
DESCRIPTION_2 = """ <div style="text-align: center;font-size: 24px;"> <h1> Multi-Layered Latent Decomposition and Fusion for Unified & Accurate Image Editing</h1></div>"""
|
32 |
+
DESCRIPTION_3 = """
|
33 |
+
<div style="text-align: center; font-size: 24px;">
|
34 |
+
<p> Gradio demo for <a href="https://design-edit.github.io/">DesignEdit</a></p>
|
35 |
+
</div>
|
36 |
+
"""
|
37 |
+
|
38 |
+
with gr.Blocks(css='style.css') as demo:
|
39 |
+
gr.Markdown(DESCRIPTION_1)
|
40 |
+
gr.Markdown(DESCRIPTION_2)
|
41 |
+
gr.Markdown(DESCRIPTION_3)
|
42 |
+
with gr.Tabs():
|
43 |
+
with gr.TabItem('1οΈβ£ Object Removal'):
|
44 |
+
create_demo_remove(model.run_remove)
|
45 |
+
with gr.TabItem('2οΈβ£ Zooming Out'):
|
46 |
+
create_demo_zooming(model.run_zooming)
|
47 |
+
with gr.TabItem('3οΈβ£ Camera Panning'):
|
48 |
+
create_demo_panning(model.run_panning)
|
49 |
+
with gr.TabItem('4οΈβ£ Object Moving, Resizing and Flipping'):
|
50 |
+
create_demo_moving(model.run_moving)
|
51 |
+
with gr.TabItem('5οΈβ£ π© Multi-Layered Editing π©'):
|
52 |
+
create_demo_layer(model.run_layer)
|
53 |
+
with gr.TabItem('π§ Mask Preparation: Draw or Sketch'):
|
54 |
+
create_demo_mask_box(model.run_mask)
|
55 |
+
demo.queue(concurrency_count=3, max_size=20)
|
56 |
+
demo.launch(server_name="0.0.0.0")
|
57 |
+
|
examples/layer/01_horse/00.jpg
ADDED
examples/layer/01_horse/mask0.jpg
ADDED
examples/layer/02_baby/00.jpg
ADDED
examples/layer/02_baby/mask0.jpg
ADDED
examples/layer/02_baby/mask1.jpg
ADDED
examples/layer/02_baby/mask2.jpg
ADDED
examples/layer/03_text/00.jpg
ADDED
examples/layer/03_text/01.jpg
ADDED
examples/layer/03_text/mask0.jpg
ADDED
examples/layer/03_text/mask1.jpg
ADDED
examples/layer/04_cross/0.jpg
ADDED
examples/layer/04_cross/1.jpg
ADDED
examples/layer/04_cross/2.jpg
ADDED
examples/layer/04_cross/3.jpg
ADDED
examples/layer/04_cross/mask0.jpg
ADDED
examples/layer/04_cross/mask1.jpg
ADDED
examples/layer/04_cross/mask2.jpg
ADDED
examples/layer/04_cross/mask3.jpg
ADDED
examples/moving/01_ball/0.jpg
ADDED
examples/moving/01_ball/mask0.jpg
ADDED
examples/moving/02_bell/0.jpg
ADDED
examples/moving/02_bell/mask0.jpg
ADDED
examples/pan/01.jpg
ADDED
examples/pan/02.jpg
ADDED
examples/pan/03.jpg
ADDED
examples/pan/04.jpg
ADDED
examples/pan/05.jpg
ADDED
examples/pan/06.jpg
ADDED
examples/remove/01_moto/0.jpg
ADDED
examples/remove/01_moto/mask0.jpg
ADDED
examples/remove/01_moto/mask1.jpg
ADDED
examples/remove/02_ring/0.jpg
ADDED
examples/remove/02_ring/mask0.jpg
ADDED
examples/remove/02_ring/mask1.jpg
ADDED
examples/remove/02_ring/mask2.jpg
ADDED
examples/remove/03_ball/0.jpg
ADDED
examples/remove/03_ball/mask0.jpg
ADDED
examples/remove/03_ball/mask1.jpg
ADDED
examples/remove/04_pikachu/0.jpg
ADDED
examples/remove/04_pikachu/mask0.jpg
ADDED
examples/remove/04_pikachu/mask1.jpg
ADDED
examples/remove/04_pikachu/mask2.jpg
ADDED
examples/remove/05_betty/0.jpg
ADDED
examples/remove/05_betty/mask0.jpg
ADDED
examples/zoom/01.jpg
ADDED
examples/zoom/02.jpg
ADDED
examples/zoom/03.jpg
ADDED
examples/zoom/04.jpg
ADDED