Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -222,17 +222,13 @@ def infer_auto(project_name, video_in, subject_to_remove):
|
|
| 222 |
|
| 223 |
|
| 224 |
#bmx_trees_folder = os.path.join(output_folder, "bmx-trees")
|
| 225 |
-
|
| 226 |
-
# Convert the float fps to an integer
|
| 227 |
-
needed_fps = int(video_frames[1])
|
| 228 |
-
|
| 229 |
command = [
|
| 230 |
f"python",
|
| 231 |
f"inference_propainter.py",
|
| 232 |
f"--video={video_frames_folder}",
|
| 233 |
f"--mask={masks_folder}",
|
| 234 |
-
f"--output={output_folder}"
|
| 235 |
-
f"--save_fps={needed_fps}"
|
| 236 |
]
|
| 237 |
|
| 238 |
execute_command(command)
|
|
@@ -253,7 +249,27 @@ def infer_auto(project_name, video_in, subject_to_remove):
|
|
| 253 |
for item in results_folder_content:
|
| 254 |
print(item)
|
| 255 |
|
| 256 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 257 |
|
| 258 |
css="""
|
| 259 |
#col-container{
|
|
|
|
| 222 |
|
| 223 |
|
| 224 |
#bmx_trees_folder = os.path.join(output_folder, "bmx-trees")
|
| 225 |
+
|
|
|
|
|
|
|
|
|
|
| 226 |
command = [
|
| 227 |
f"python",
|
| 228 |
f"inference_propainter.py",
|
| 229 |
f"--video={video_frames_folder}",
|
| 230 |
f"--mask={masks_folder}",
|
| 231 |
+
f"--output={output_folder}"
|
|
|
|
| 232 |
]
|
| 233 |
|
| 234 |
execute_command(command)
|
|
|
|
| 249 |
for item in results_folder_content:
|
| 250 |
print(item)
|
| 251 |
|
| 252 |
+
|
| 253 |
+
# Convert the float fps to an integer
|
| 254 |
+
needed_fps = int(video_frames[1])
|
| 255 |
+
|
| 256 |
+
# Load the videos
|
| 257 |
+
video1 = VideoFileClip(results_folder_content[0])
|
| 258 |
+
video2 = VideoFileClip(results_folder_content[1])
|
| 259 |
+
|
| 260 |
+
# Set the desired frame rate (e.g., 12 fps)
|
| 261 |
+
new_fps = needed_fps
|
| 262 |
+
|
| 263 |
+
# Convert videos to the new frame rate
|
| 264 |
+
video1 = video1.set_duration(video1.duration).set_fps(new_fps)
|
| 265 |
+
video2 = video2.set_duration(video2.duration).set_fps(new_fps)
|
| 266 |
+
|
| 267 |
+
# Save the converted videos
|
| 268 |
+
video1.write_videofile(f'masked_{new_fps}fps.mp4', fps=new_fps)
|
| 269 |
+
video2.write_videofile(f'final_{new_fps}fps.mp4', fps=new_fps)
|
| 270 |
+
|
| 271 |
+
|
| 272 |
+
return "done", f'masked_{new_fps}fps.mp4', f'final_{new_fps}fps.mp4'
|
| 273 |
|
| 274 |
css="""
|
| 275 |
#col-container{
|