Nick088 commited on
Commit
f2f13c6
·
verified ·
1 Parent(s): dcedef1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -2
app.py CHANGED
@@ -64,8 +64,16 @@ def inference_video(video, size):
64
  os.system("rm -rf " + INPUT_DIR)
65
  os.system("mkdir " + INPUT_DIR)
66
  input_image_path = os.path.join(INPUT_DIR, 'input.jpg')
67
- video.save(input_image_path)
68
- video.save(INPUT_DIR + "input.mp4", "MP4")
 
 
 
 
 
 
 
 
69
  os.system("python inference_video.py")
70
  return os.path.join('/tmp/results_mp4_videos/', 'input.mp4')
71
 
 
64
  os.system("rm -rf " + INPUT_DIR)
65
  os.system("mkdir " + INPUT_DIR)
66
  input_image_path = os.path.join(INPUT_DIR, 'input.jpg')
67
+ try:
68
+ # Specify the desired output file path with the custom name and ".mp4" extension
69
+ output_file_path = f"/tmp/videos/{custom_name}.mp4"
70
+
71
+ # Save the video input to the specified file path
72
+ with open(output_file_path, 'wb') as output_file:
73
+ output_file.write(video)
74
+ print(f"Video input saved as {output_file_path}")
75
+ except Exception as e:
76
+ print(f"Error saving video input: {str(e)}")
77
  os.system("python inference_video.py")
78
  return os.path.join('/tmp/results_mp4_videos/', 'input.mp4')
79