Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -27,7 +27,7 @@ def get_frame_count_in_duration(filepath):
|
|
| 27 |
width = int(video.get(cv2.CAP_PROP_FRAME_WIDTH))
|
| 28 |
height = int(video.get(cv2.CAP_PROP_FRAME_HEIGHT))
|
| 29 |
video.release()
|
| 30 |
-
return gr.update(maximum=frame_count)
|
| 31 |
|
| 32 |
def get_video_dimension(filepath):
|
| 33 |
video = cv2.VideoCapture(filepath)
|
|
@@ -72,9 +72,9 @@ def resize_video(input_file):
|
|
| 72 |
|
| 73 |
|
| 74 |
#final_video_resized = os.path.join(temp_output_path, 'video_resized.mp4')
|
| 75 |
-
test_w, test_h, fps = get_video_dimension('video_resized.mp4')
|
| 76 |
print(f"resized clip dims : {test_w}, {test_h}, {fps}")
|
| 77 |
-
return 'video_resized.mp4'
|
| 78 |
|
| 79 |
def run_inference(prompt, video_path, condition, video_length):
|
| 80 |
|
|
@@ -174,10 +174,10 @@ with gr.Blocks(css=css) as demo:
|
|
| 174 |
with gr.Column():
|
| 175 |
video_res = gr.Video(label="result")
|
| 176 |
status = gr.Textbox(label="result")
|
| 177 |
-
video_path.change(fn=
|
| 178 |
inputs=[video_path],
|
| 179 |
-
outputs=[video_length]
|
| 180 |
-
)
|
| 181 |
submit_btn.click(fn=run_inference,
|
| 182 |
inputs=[prompt,
|
| 183 |
video_path,
|
|
|
|
| 27 |
width = int(video.get(cv2.CAP_PROP_FRAME_WIDTH))
|
| 28 |
height = int(video.get(cv2.CAP_PROP_FRAME_HEIGHT))
|
| 29 |
video.release()
|
| 30 |
+
return gr.update(), gr.update(maximum=frame_count)
|
| 31 |
|
| 32 |
def get_video_dimension(filepath):
|
| 33 |
video = cv2.VideoCapture(filepath)
|
|
|
|
| 72 |
|
| 73 |
|
| 74 |
#final_video_resized = os.path.join(temp_output_path, 'video_resized.mp4')
|
| 75 |
+
test_w, test_h, fps, frame_count = get_video_dimension('video_resized.mp4')
|
| 76 |
print(f"resized clip dims : {test_w}, {test_h}, {fps}")
|
| 77 |
+
return 'video_resized.mp4', gr.update(maximum=frame_count)
|
| 78 |
|
| 79 |
def run_inference(prompt, video_path, condition, video_length):
|
| 80 |
|
|
|
|
| 174 |
with gr.Column():
|
| 175 |
video_res = gr.Video(label="result")
|
| 176 |
status = gr.Textbox(label="result")
|
| 177 |
+
video_path.change(fn=resize_video,
|
| 178 |
inputs=[video_path],
|
| 179 |
+
outputs=[video_path, video_length]
|
| 180 |
+
)
|
| 181 |
submit_btn.click(fn=run_inference,
|
| 182 |
inputs=[prompt,
|
| 183 |
video_path,
|