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