Spaces:
Runtime error
Runtime error
Update inference_video.py
Browse files- inference_video.py +16 -0
inference_video.py
CHANGED
|
@@ -63,6 +63,22 @@ def inference_image(image, size):
|
|
| 63 |
print(f"Image size ({device}): {size} ... OK")
|
| 64 |
return result
|
| 65 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 66 |
|
| 67 |
# assign directory
|
| 68 |
directory = 'videos' #PATH_WITH_INPUT_VIDEOS
|
|
|
|
| 63 |
print(f"Image size ({device}): {size} ... OK")
|
| 64 |
return result
|
| 65 |
|
| 66 |
+
custom_name = "input.mp4"
|
| 67 |
+
|
| 68 |
+
def save_video_input(video, custom_name):
|
| 69 |
+
try:
|
| 70 |
+
# Specify the desired output file path with the custom name and ".mp4" extension
|
| 71 |
+
output_file_path = f"videos/{custom_name}.mp4"
|
| 72 |
+
|
| 73 |
+
# Save the video input to the specified file path
|
| 74 |
+
with open(output_file_path, 'wb') as output_file:
|
| 75 |
+
output_file.write(video_input)
|
| 76 |
+
print(f"Video input saved as {output_file_path}")
|
| 77 |
+
except Exception as e:
|
| 78 |
+
print(f"Error saving video input: {str(e)}")
|
| 79 |
+
|
| 80 |
+
|
| 81 |
+
|
| 82 |
|
| 83 |
# assign directory
|
| 84 |
directory = 'videos' #PATH_WITH_INPUT_VIDEOS
|