fffiloni commited on
Commit
3a66e37
1 Parent(s): 6fcb174

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -1
app.py CHANGED
@@ -14,9 +14,22 @@ for model_id in model_ids:
14
  snapshot_download(model_id, local_dir=f'checkpoints/{model_name}')
15
 
16
  import subprocess
 
 
 
 
 
 
 
 
 
 
 
17
 
18
  def run_inference(prompt, video_path, condition, video_length):
19
-
 
 
20
  output_path = 'output/'
21
  os.makedirs(output_path, exist_ok=True)
22
  command = f"python inference.py --prompt '{prompt}' --condition '{condition}' --video_path '{video_path}' --output_path '{output_path}' --video_length {video_length} --smoother_steps 19 20"
 
14
  snapshot_download(model_id, local_dir=f'checkpoints/{model_name}')
15
 
16
  import subprocess
17
+ from moviepy.editor import VideoFileClip
18
+
19
+ def get_video_properties(filepath):
20
+ video = VideoFileClip(filepath)
21
+ duration = video.duration
22
+ fps = video.fps
23
+ video.close()
24
+ return duration, fps
25
+
26
+
27
+
28
 
29
  def run_inference(prompt, video_path, condition, video_length):
30
+ # Call the function to get the video properties
31
+ duration, fps = get_video_properties(video_path)
32
+ video_length = video_length * fps
33
  output_path = 'output/'
34
  os.makedirs(output_path, exist_ok=True)
35
  command = f"python inference.py --prompt '{prompt}' --condition '{condition}' --video_path '{video_path}' --output_path '{output_path}' --video_length {video_length} --smoother_steps 19 20"