lev1 commited on
Commit
529a0a6
1 Parent(s): b01b03e

New examples for Depth guided T2V0

Browse files
Files changed (3) hide show
  1. app_depth.py +27 -14
  2. gradio_utils.py +18 -2
  3. model.py +1 -1
app_depth.py CHANGED
@@ -7,20 +7,33 @@ on_huggingspace = os.environ.get("SPACE_AUTHOR_NAME") == "PAIR"
7
  def create_demo(model: Model):
8
 
9
  examples = [
10
- ["__assets__/depth_videos/butterfly.mp4",
11
- "white butterfly, a high-quality, detailed, and professional photo"],
12
- ["__assets__/depth_videos/deer.mp4",
13
- "oil painting of a deer, a high-quality, detailed, and professional photo"],
14
- ["__assets__/depth_videos/fox.mp4",
15
- "wild red fox is walking on the grass, a high-quality, detailed, and professional photo"],
16
- ["__assets__/depth_videos/girl_dancing.mp4",
17
- "oil painting of a girl dancing close-up, masterpiece, a high-quality, detailed, and professional photo"],
18
- ["__assets__/depth_videos/girl_turning.mp4",
19
- "oil painting of a beautiful girl, a high-quality, detailed, and professional photo"],
20
- ["__assets__/depth_videos/halloween.mp4",
21
- "beautiful girl halloween style, a high-quality, detailed, and professional photo"],
22
- ["__assets__/depth_videos/santa.mp4",
23
- "a santa claus, a high-quality, detailed, and professional photo"],
 
 
 
 
 
 
 
 
 
 
 
 
 
24
  ]
25
 
26
  with gr.Blocks() as demo:
 
7
  def create_demo(model: Model):
8
 
9
  examples = [
10
+ ["__assets__/depth_videos_depth/girl_dancing.mp4",
11
+ "A stormtrooper, masterpiece, a high-quality, detailed, and professional photo"],
12
+ ["__assets__/depth_videos_depth/girl_dancing.mp4",
13
+ "Oil painting of a catwoman, masterpiece, a high-quality, detailed, and professional photo"],
14
+ ["__assets__/depth_videos_depth/girl_dancing.mp4",
15
+ "Oil painting of a girl dancing closed eyes, masterpiece, a high-quality, detailed, and professional photo"],
16
+
17
+ ["__assets__/depth_videos_depth/woman.mp4",
18
+ "A robot is dancing in the Sahara desert, detailed, and professional photo"],
19
+ ["__assets__/depth_videos_depth/woman.mp4",
20
+ "Wonder woman is dancing, a high-quality, detailed, and professional photo"],
21
+ ["__assets__/depth_videos_depth/woman.mp4",
22
+ "Oil painting of a girl dancing close-up, masterpiece, a high-quality, detailed, and professional photo"],
23
+
24
+ ["__assets__/depth_videos_depth/man.mp4",
25
+ "An astronaut is Dancing in space, a high-quality, detailed, and professional photo"],
26
+ ["__assets__/depth_videos_depth/man.mp4",
27
+ "Iron Man is dancing, a high-quality, detailed, and professional photo"],
28
+ ["__assets__/depth_videos_depth/man.mp4",
29
+ "Spiderman is Dancing, a high-quality, detailed, and professional photo"],
30
+
31
+ ["__assets__/depth_videos_depth/halloween.mp4",
32
+ "Beautiful blonde girl, a high-quality, detailed, and professional photo"],
33
+ ["__assets__/depth_videos_depth/halloween.mp4",
34
+ "Beautiful brunette girl, a high-quality, detailed, and professional photo"],
35
+ ["__assets__/depth_videos_depth/halloween.mp4",
36
+ "Beautiful red-haired girl, a high-quality, detailed, and professional photo"],
37
  ]
38
 
39
  with gr.Blocks() as demo:
gradio_utils.py CHANGED
@@ -1,8 +1,6 @@
1
  import os
2
 
3
  # App Canny utils
4
-
5
-
6
  def edge_path_to_video_path(edge_path):
7
  video_path = edge_path
8
 
@@ -96,3 +94,21 @@ def logo_name_to_path(name):
96
  if name in logo_paths:
97
  return logo_paths[name]
98
  return name
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  import os
2
 
3
  # App Canny utils
 
 
4
  def edge_path_to_video_path(edge_path):
5
  video_path = edge_path
6
 
 
94
  if name in logo_paths:
95
  return logo_paths[name]
96
  return name
97
+
98
+
99
+ # App Depth utils
100
+ def depth_path_to_video_path(edge_path):
101
+ video_path = edge_path
102
+
103
+ vid_name = edge_path.split("/")[-1]
104
+ if vid_name == "girl_dancing.mp4":
105
+ video_path = "__assets__/depth_videos_mp4/girl_dancing.mp4"
106
+ elif vid_name == "halloween.mp4":
107
+ video_path = "__assets__/depth_videos_mp4/halloween.mp4"
108
+ elif vid_name == "man.mp4":
109
+ video_path = "__assets__/depth_videos_mp4/man.mp4"
110
+ elif vid_name == "woman.mp4":
111
+ video_path = "__assets__/depth_videos_mp4/woman.mp4"
112
+
113
+ assert os.path.isfile(video_path)
114
+ return video_path
model.py CHANGED
@@ -211,7 +211,7 @@ class Model:
211
  use_cf_attn=True,
212
  save_path=None):
213
  print("Module Depth")
214
- video_path = gradio_utils.edge_path_to_video_path(video_path)
215
  if self.model_type != ModelType.ControlNetDepth:
216
  controlnet = ControlNetModel.from_pretrained(
217
  "lllyasviel/sd-controlnet-depth")
 
211
  use_cf_attn=True,
212
  save_path=None):
213
  print("Module Depth")
214
+ video_path = gradio_utils.depth_path_to_video_path(video_path)
215
  if self.model_type != ModelType.ControlNetDepth:
216
  controlnet = ControlNetModel.from_pretrained(
217
  "lllyasviel/sd-controlnet-depth")