Spaces:
Sleeping
Sleeping
sunrainyg
commited on
Commit
Β·
cdc1784
1
Parent(s):
05b3646
Update
Browse files
app.py
CHANGED
|
@@ -15,30 +15,30 @@ text = processor.batch_decode(generated_ids.unsqueeze(0), skip_special_tokens=Tr
|
|
| 15 |
return text.strip()
|
| 16 |
|
| 17 |
with gr.Blocks(title="Video β Q&A (Qwen2.5-VL-7B WolfV2)") as demo:
|
| 18 |
-
gr.Markdown("""
|
| 19 |
-
# π¬ Video β Q&A (Qwen2.5-VL-7B WolfV2)
|
| 20 |
-
- Drag and drop or upload any video, then input your question and click **Ask**.
|
| 21 |
-
- Default `fps=1` (1 frame per second) saves GPU memory; if the video is short with many details, you can increase the fps.
|
| 22 |
-
""")
|
| 23 |
|
| 24 |
with gr.Row():
|
| 25 |
-
video = gr.Video(label="Drag video here (mp4, mov, webm)", interactive=True)
|
| 26 |
with gr.Column():
|
| 27 |
-
question = gr.Textbox(label="Your question", placeholder="Example: What's happening in the video? Provide 5 Q&A pairs.")
|
| 28 |
-
ask = gr.Button("Ask", variant="primary")
|
| 29 |
-
output = gr.Textbox(label="Answer", lines=12)
|
| 30 |
|
| 31 |
with gr.Accordion("Advanced", open=False):
|
| 32 |
-
fps = gr.Slider(1, 6, value=1, step=1, label="Sampling rate (fps)")
|
| 33 |
-
max_new_tokens = gr.Slider(32, 512, value=192, step=16, label="max_new_tokens")
|
| 34 |
-
temperature = gr.Slider(0.0, 1.2, value=0.2, step=0.05, label="temperature")
|
| 35 |
-
top_p = gr.Slider(0.1, 1.0, value=0.9, step=0.05, label="top_p")
|
| 36 |
|
| 37 |
ask.click(
|
| 38 |
-
fn=answer,
|
| 39 |
-
inputs=[video, question, fps, max_new_tokens, temperature, top_p],
|
| 40 |
-
outputs=[output],
|
| 41 |
-
)
|
| 42 |
|
| 43 |
if __name__ == "__main__":
|
| 44 |
demo.launch()
|
|
|
|
| 15 |
return text.strip()
|
| 16 |
|
| 17 |
with gr.Blocks(title="Video β Q&A (Qwen2.5-VL-7B WolfV2)") as demo:
|
| 18 |
+
gr.Markdown("""
|
| 19 |
+
# π¬ Video β Q&A (Qwen2.5-VL-7B WolfV2)
|
| 20 |
+
- Drag and drop or upload any video, then input your question and click **Ask**.
|
| 21 |
+
- Default `fps=1` (1 frame per second) saves GPU memory; if the video is short with many details, you can increase the fps.
|
| 22 |
+
""")
|
| 23 |
|
| 24 |
with gr.Row():
|
| 25 |
+
video = gr.Video(label="Drag video here (mp4, mov, webm)", interactive=True)
|
| 26 |
with gr.Column():
|
| 27 |
+
question = gr.Textbox(label="Your question", placeholder="Example: What's happening in the video? Provide 5 Q&A pairs.")
|
| 28 |
+
ask = gr.Button("Ask", variant="primary")
|
| 29 |
+
output = gr.Textbox(label="Answer", lines=12)
|
| 30 |
|
| 31 |
with gr.Accordion("Advanced", open=False):
|
| 32 |
+
fps = gr.Slider(1, 6, value=1, step=1, label="Sampling rate (fps)")
|
| 33 |
+
max_new_tokens = gr.Slider(32, 512, value=192, step=16, label="max_new_tokens")
|
| 34 |
+
temperature = gr.Slider(0.0, 1.2, value=0.2, step=0.05, label="temperature")
|
| 35 |
+
top_p = gr.Slider(0.1, 1.0, value=0.9, step=0.05, label="top_p")
|
| 36 |
|
| 37 |
ask.click(
|
| 38 |
+
fn=answer,
|
| 39 |
+
inputs=[video, question, fps, max_new_tokens, temperature, top_p],
|
| 40 |
+
outputs=[output],
|
| 41 |
+
)
|
| 42 |
|
| 43 |
if __name__ == "__main__":
|
| 44 |
demo.launch()
|