jiayueru commited on
Commit
7352753
β€’
1 Parent(s): e5db25f
This view is limited to 50 files because it contains too many changes. Β  See raw diff
Files changed (50) hide show
  1. .gitignore +7 -0
  2. app.py +57 -0
  3. examples/layer/01_horse/00.jpg +0 -0
  4. examples/layer/01_horse/mask0.jpg +0 -0
  5. examples/layer/02_baby/00.jpg +0 -0
  6. examples/layer/02_baby/mask0.jpg +0 -0
  7. examples/layer/02_baby/mask1.jpg +0 -0
  8. examples/layer/02_baby/mask2.jpg +0 -0
  9. examples/layer/03_text/00.jpg +0 -0
  10. examples/layer/03_text/01.jpg +0 -0
  11. examples/layer/03_text/mask0.jpg +0 -0
  12. examples/layer/03_text/mask1.jpg +0 -0
  13. examples/layer/04_cross/0.jpg +0 -0
  14. examples/layer/04_cross/1.jpg +0 -0
  15. examples/layer/04_cross/2.jpg +0 -0
  16. examples/layer/04_cross/3.jpg +0 -0
  17. examples/layer/04_cross/mask0.jpg +0 -0
  18. examples/layer/04_cross/mask1.jpg +0 -0
  19. examples/layer/04_cross/mask2.jpg +0 -0
  20. examples/layer/04_cross/mask3.jpg +0 -0
  21. examples/moving/01_ball/0.jpg +0 -0
  22. examples/moving/01_ball/mask0.jpg +0 -0
  23. examples/moving/02_bell/0.jpg +0 -0
  24. examples/moving/02_bell/mask0.jpg +0 -0
  25. examples/pan/01.jpg +0 -0
  26. examples/pan/02.jpg +0 -0
  27. examples/pan/03.jpg +0 -0
  28. examples/pan/04.jpg +0 -0
  29. examples/pan/05.jpg +0 -0
  30. examples/pan/06.jpg +0 -0
  31. examples/remove/01_moto/0.jpg +0 -0
  32. examples/remove/01_moto/mask0.jpg +0 -0
  33. examples/remove/01_moto/mask1.jpg +0 -0
  34. examples/remove/02_ring/0.jpg +0 -0
  35. examples/remove/02_ring/mask0.jpg +0 -0
  36. examples/remove/02_ring/mask1.jpg +0 -0
  37. examples/remove/02_ring/mask2.jpg +0 -0
  38. examples/remove/03_ball/0.jpg +0 -0
  39. examples/remove/03_ball/mask0.jpg +0 -0
  40. examples/remove/03_ball/mask1.jpg +0 -0
  41. examples/remove/04_pikachu/0.jpg +0 -0
  42. examples/remove/04_pikachu/mask0.jpg +0 -0
  43. examples/remove/04_pikachu/mask1.jpg +0 -0
  44. examples/remove/04_pikachu/mask2.jpg +0 -0
  45. examples/remove/05_betty/0.jpg +0 -0
  46. examples/remove/05_betty/mask0.jpg +0 -0
  47. examples/zoom/01.jpg +0 -0
  48. examples/zoom/02.jpg +0 -0
  49. examples/zoom/03.jpg +0 -0
  50. 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