Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -126,10 +126,10 @@ def run_inference(prompt, video_path, condition, video_length, seed, steps):
|
|
| 126 |
total_frames = get_video_dimension(video_path)[3]
|
| 127 |
|
| 128 |
# Resize the video
|
| 129 |
-
resized = resize_video(video_path, 'resized.mp4', 512, 512, target_fps)
|
| 130 |
|
| 131 |
# normalize pixels
|
| 132 |
-
normalized = normalize_and_save_video(resized, 'normalized.mp4')
|
| 133 |
|
| 134 |
output_path = 'output/'
|
| 135 |
os.makedirs(output_path, exist_ok=True)
|
|
@@ -141,27 +141,27 @@ def run_inference(prompt, video_path, condition, video_length, seed, steps):
|
|
| 141 |
|
| 142 |
print(f"RUNNING INFERENCE ...")
|
| 143 |
if video_length > 12:
|
| 144 |
-
command = f"python inference.py --prompt '{prompt}' --inference_steps {steps} --condition '{condition}' --video_path '{
|
| 145 |
else:
|
| 146 |
-
command = f"python inference.py --prompt '{prompt}' --inference_steps {steps} --condition '{condition}' --video_path '{
|
|
|
|
| 147 |
try:
|
| 148 |
subprocess.run(command, shell=True)
|
| 149 |
-
|
| 150 |
-
# Construct the video path
|
| 151 |
-
video_path_output = os.path.join(output_path, f"result.mp4")
|
| 152 |
-
|
| 153 |
-
# Resize to original video input size
|
| 154 |
-
o_width = get_video_dimension(video_path)[0]
|
| 155 |
-
o_height = get_video_dimension(video_path)[1]
|
| 156 |
-
resize_video(video_path_output, 'resized_final.mp4', o_width, o_height, target_fps)
|
| 157 |
-
|
| 158 |
-
print(f"FINISHED !")
|
| 159 |
-
return "done", 'resized_final.mp4'
|
| 160 |
except cuda.Error as e:
|
| 161 |
return f"CUDA Error: {e}", None
|
| 162 |
except RuntimeError as e:
|
| 163 |
return f"Runtime Error: {e}", None
|
| 164 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 165 |
|
| 166 |
|
| 167 |
css="""
|
|
|
|
| 126 |
total_frames = get_video_dimension(video_path)[3]
|
| 127 |
|
| 128 |
# Resize the video
|
| 129 |
+
#resized = resize_video(video_path, 'resized.mp4', 512, 512, target_fps)
|
| 130 |
|
| 131 |
# normalize pixels
|
| 132 |
+
#normalized = normalize_and_save_video(resized, 'normalized.mp4')
|
| 133 |
|
| 134 |
output_path = 'output/'
|
| 135 |
os.makedirs(output_path, exist_ok=True)
|
|
|
|
| 141 |
|
| 142 |
print(f"RUNNING INFERENCE ...")
|
| 143 |
if video_length > 12:
|
| 144 |
+
command = f"python inference.py --prompt '{prompt}' --inference_steps {steps} --condition '{condition}' --video_path '{video_path}' --output_path '{output_path}' --temp_chunk_path 'result' --width 512 --height 512 --fps {target_fps} --seed {seed} --video_length {video_length} --smoother_steps 19 20 --is_long_video"
|
| 145 |
else:
|
| 146 |
+
command = f"python inference.py --prompt '{prompt}' --inference_steps {steps} --condition '{condition}' --video_path '{video_path}' --output_path '{output_path}' --temp_chunk_path 'result' --width 512 --height 512 --fps {target_fps} --seed {seed} --video_length {video_length} --smoother_steps 19 20"
|
| 147 |
+
|
| 148 |
try:
|
| 149 |
subprocess.run(command, shell=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 150 |
except cuda.Error as e:
|
| 151 |
return f"CUDA Error: {e}", None
|
| 152 |
except RuntimeError as e:
|
| 153 |
return f"Runtime Error: {e}", None
|
| 154 |
|
| 155 |
+
# Construct the video path
|
| 156 |
+
video_path_output = os.path.join(output_path, f"result.mp4")
|
| 157 |
+
|
| 158 |
+
# Resize to original video input size
|
| 159 |
+
o_width = get_video_dimension(video_path)[0]
|
| 160 |
+
o_height = get_video_dimension(video_path)[1]
|
| 161 |
+
resize_video(video_path_output, 'resized_final.mp4', o_width, o_height, target_fps)
|
| 162 |
+
|
| 163 |
+
print(f"FINISHED !")
|
| 164 |
+
return "done", 'resized_final.mp4'
|
| 165 |
|
| 166 |
|
| 167 |
css="""
|