fffiloni commited on
Commit
7ca5351
1 Parent(s): f6be7c6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +29 -4
app.py CHANGED
@@ -1,4 +1,5 @@
1
- ort os
 
2
  import numpy as np
3
  import argparse
4
  import imageio
@@ -60,14 +61,19 @@ def get_args():
60
  args = parser.parse_args()
61
  return args
62
 
63
- def infer(prompt, video_path, output_path, condition, video_length, height, width, smoother_steps, is_long_video, seed):
64
  #args = get_args()
65
  #os.makedirs(args.output_path, exist_ok=True)
66
 
67
  # Height and width should be a multiple of 32
 
 
68
  height = (height // 32) * 32
69
  width = (width // 32) * 32
70
-
 
 
 
71
  if condition == "pose":
72
  pretrained_model_or_path = "lllyasviel/ControlNet"
73
  body_model_path = hf_hub_download(pretrained_model_or_path, "annotator/ckpts/body_pose_model.pth", cache_dir="checkpoints")
@@ -132,4 +138,23 @@ def infer(prompt, video_path, output_path, condition, video_length, height, widt
132
  ).videos
133
  save_videos_grid(sample, f"{output_path}/{prompt}.mp4")
134
 
135
- return f"{output_path}/{prompt}.mp4"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio
2
+ import os
3
  import numpy as np
4
  import argparse
5
  import imageio
 
61
  args = parser.parse_args()
62
  return args
63
 
64
+ def infer(prompt, video_path, condition, video_length, is_long_video):
65
  #args = get_args()
66
  #os.makedirs(args.output_path, exist_ok=True)
67
 
68
  # Height and width should be a multiple of 32
69
+ output_path = ""
70
+ height, width = 512
71
  height = (height // 32) * 32
72
  width = (width // 32) * 32
73
+ smoother_steps = [19, 20]
74
+ is_long_video = False
75
+ seed = 42
76
+
77
  if condition == "pose":
78
  pretrained_model_or_path = "lllyasviel/ControlNet"
79
  body_model_path = hf_hub_download(pretrained_model_or_path, "annotator/ckpts/body_pose_model.pth", cache_dir="checkpoints")
 
138
  ).videos
139
  save_videos_grid(sample, f"{output_path}/{prompt}.mp4")
140
 
141
+ return f"{output_path}/{prompt}.mp4"
142
+
143
+ with gr.Blocks() as demo:
144
+ with gr.Column():
145
+ prompt = gr.Textbox(label="prompt")
146
+ video_path = gr.Video(source="upload", type="filepath")
147
+ condition = gr.Textbox(label="Condition", value="depth")
148
+ video_length = gr.Slider(label="video length", minimum=1, maximum=15, step=1, value=2)
149
+ seed = gr.Number(label="seed", valie=42)
150
+ submit_btn = gr.Button("Submit")
151
+ video_res = gr.Video(label="result")
152
+
153
+ submit_btn.click(fn=infer,
154
+ inputs=[prompt,
155
+ video_path,
156
+ condition,
157
+ video_length,
158
+ seed,
159
+ ]
160
+ outputs=[video_res])