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(), gr.update(maximum=frame_count)
|
| 31 |
|
| 32 |
def get_video_dimension(filepath):
|
| 33 |
video = cv2.VideoCapture(filepath)
|
|
@@ -165,7 +165,8 @@ with gr.Blocks(css=css) as demo:
|
|
| 165 |
""")
|
| 166 |
with gr.Row():
|
| 167 |
with gr.Column():
|
| 168 |
-
|
|
|
|
| 169 |
prompt = gr.Textbox(label="prompt")
|
| 170 |
with gr.Row():
|
| 171 |
condition = gr.Dropdown(label="Condition", choices=["depth", "canny", "pose"], value="depth")
|
|
@@ -175,9 +176,9 @@ with gr.Blocks(css=css) as demo:
|
|
| 175 |
with gr.Column():
|
| 176 |
video_res = gr.Video(label="result")
|
| 177 |
status = gr.Textbox(label="result")
|
| 178 |
-
|
| 179 |
inputs=[video_path],
|
| 180 |
-
outputs=[video_path, video_length]
|
| 181 |
)
|
| 182 |
submit_btn.click(fn=run_inference,
|
| 183 |
inputs=[prompt,
|
|
|
|
| 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(visible=False), gr.update(visible=True), gr.update(maximum=frame_count)
|
| 31 |
|
| 32 |
def get_video_dimension(filepath):
|
| 33 |
video = cv2.VideoCapture(filepath)
|
|
|
|
| 165 |
""")
|
| 166 |
with gr.Row():
|
| 167 |
with gr.Column():
|
| 168 |
+
video_in = gr.Video(source="upload", type="filepath", visible=True)
|
| 169 |
+
video_path = gr.Video(source="upload", type="filepath", visible=False)
|
| 170 |
prompt = gr.Textbox(label="prompt")
|
| 171 |
with gr.Row():
|
| 172 |
condition = gr.Dropdown(label="Condition", choices=["depth", "canny", "pose"], value="depth")
|
|
|
|
| 176 |
with gr.Column():
|
| 177 |
video_res = gr.Video(label="result")
|
| 178 |
status = gr.Textbox(label="result")
|
| 179 |
+
video_in.change(fn=resize_video,
|
| 180 |
inputs=[video_path],
|
| 181 |
+
outputs=[video_in, video_path, video_length]
|
| 182 |
)
|
| 183 |
submit_btn.click(fn=run_inference,
|
| 184 |
inputs=[prompt,
|