Spaces:
Sleeping
Sleeping
Commit ·
1ff6e50
1
Parent(s): 07b432d
Add a Capture button directly under the player
Browse filesA second 'Capture current frame' button sits right under the video player (step 1),
in addition to the one in the frames section (step 4); both share the same handler.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
app.py
CHANGED
|
@@ -399,6 +399,9 @@ def build_ui() -> gr.Blocks:
|
|
| 399 |
file_types=[".mp4", ".mov", ".mkv", ".webm", ".avi", ".m4v", ".mpg", ".mpeg"],
|
| 400 |
)
|
| 401 |
player = gr.HTML()
|
|
|
|
|
|
|
|
|
|
| 402 |
|
| 403 |
# 2 · Transcribe → 3 · Generate guide
|
| 404 |
gr.Markdown("### 2 · Transcribe → 3 · Generate guide")
|
|
@@ -455,12 +458,15 @@ def build_ui() -> gr.Blocks:
|
|
| 455 |
hf_token.submit(on_token_set, [hf_token], [status])
|
| 456 |
upload.change(on_upload, [upload, session_state], [player, video_state, status])
|
| 457 |
|
| 458 |
-
|
| 459 |
-
|
| 460 |
-
|
| 461 |
-
|
| 462 |
-
|
| 463 |
-
|
|
|
|
|
|
|
|
|
|
| 464 |
auto_btn.click(
|
| 465 |
on_auto,
|
| 466 |
[session_state, frames_state, video_state, transcript_state, draft_state, hf_token],
|
|
|
|
| 399 |
file_types=[".mp4", ".mov", ".mkv", ".webm", ".avi", ".m4v", ".mpg", ".mpeg"],
|
| 400 |
)
|
| 401 |
player = gr.HTML()
|
| 402 |
+
capture_btn_top = gr.Button(
|
| 403 |
+
"📸 Capture current frame", variant="primary",
|
| 404 |
+
)
|
| 405 |
|
| 406 |
# 2 · Transcribe → 3 · Generate guide
|
| 407 |
gr.Markdown("### 2 · Transcribe → 3 · Generate guide")
|
|
|
|
| 458 |
hf_token.submit(on_token_set, [hf_token], [status])
|
| 459 |
upload.change(on_upload, [upload, session_state], [player, video_state, status])
|
| 460 |
|
| 461 |
+
# Both capture buttons (under the player, and in the frames section) behave
|
| 462 |
+
# identically — grab the player's current frame into the pool.
|
| 463 |
+
for _btn in (capture_btn_top, capture_btn):
|
| 464 |
+
_btn.click(
|
| 465 |
+
on_capture,
|
| 466 |
+
inputs=[session_state, frames_state, cap_url, cap_time],
|
| 467 |
+
outputs=[gallery, frames_state, status],
|
| 468 |
+
js=CAPTURE_JS,
|
| 469 |
+
)
|
| 470 |
auto_btn.click(
|
| 471 |
on_auto,
|
| 472 |
[session_state, frames_state, video_state, transcript_state, draft_state, hf_token],
|