Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -15,14 +15,21 @@ for model_id in model_ids:
|
|
| 15 |
|
| 16 |
import subprocess
|
| 17 |
|
|
|
|
| 18 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
def run_inference(prompt, video_path, condition, video_length):
|
| 23 |
# Call the function to get the video properties
|
| 24 |
-
|
| 25 |
-
|
| 26 |
#video_length = int(video_length * fps)
|
| 27 |
output_path = 'output/'
|
| 28 |
os.makedirs(output_path, exist_ok=True)
|
|
|
|
| 15 |
|
| 16 |
import subprocess
|
| 17 |
|
| 18 |
+
import cv2
|
| 19 |
|
| 20 |
+
def get_frame_count_in_duration(filepath, duration):
|
| 21 |
+
video = cv2.VideoCapture(filepath)
|
| 22 |
+
fps = video.get(cv2.CAP_PROP_FPS)
|
| 23 |
+
frame_count = int(fps * duration)
|
| 24 |
+
video.release()
|
| 25 |
+
return frame_count
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
def run_inference(prompt, video_path, condition, video_length):
|
| 30 |
# Call the function to get the video properties
|
| 31 |
+
video_length = get_video_properties(video_path, video_length)
|
| 32 |
+
print(video_length)
|
| 33 |
#video_length = int(video_length * fps)
|
| 34 |
output_path = 'output/'
|
| 35 |
os.makedirs(output_path, exist_ok=True)
|