Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -6,9 +6,15 @@ import gradio as gr
|
|
| 6 |
from src.app.response import describe_video
|
| 7 |
|
| 8 |
|
| 9 |
-
# Video
|
| 10 |
video = gr.Video(label="Video")
|
| 11 |
query = gr.Textbox(label="Question", placeholder="Enter your question here")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
|
| 13 |
# Output for the interface
|
| 14 |
response = gr.Textbox(label="Predicted answer", show_label=True, show_copy_button=True)
|
|
@@ -18,12 +24,27 @@ examples = [
|
|
| 18 |
[
|
| 19 |
"./videos/sample_video_1.mp4",
|
| 20 |
"Here are some frames of a video. Describe this video in detail.",
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
],
|
| 22 |
[
|
| 23 |
"./videos/sample_video_2.mp4",
|
| 24 |
"¿Cuál es el animal de este vídeo? ¿Cuantos animales hay?",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 25 |
],
|
| 26 |
-
["./videos/sample_video_3.mp4", "Que se passe-t-il dans cette vidéo ?"],
|
| 27 |
]
|
| 28 |
|
| 29 |
# Title, description, and article for the interface
|
|
@@ -35,7 +56,7 @@ article = "<p style='text-align: center'><a href='https://github.com/OpenBMB/Min
|
|
| 35 |
# Launch the interface
|
| 36 |
interface = gr.Interface(
|
| 37 |
fn=describe_video,
|
| 38 |
-
inputs=[video, query],
|
| 39 |
outputs=response,
|
| 40 |
examples=examples,
|
| 41 |
cache_examples=True,
|
|
|
|
| 6 |
from src.app.response import describe_video
|
| 7 |
|
| 8 |
|
| 9 |
+
# Video, text query, and input parameters
|
| 10 |
video = gr.Video(label="Video")
|
| 11 |
query = gr.Textbox(label="Question", placeholder="Enter your question here")
|
| 12 |
+
temperature = gr.Slider(
|
| 13 |
+
minimum=0.01, maximum=1.99, step=0.01, value=0.7, label="Temperature"
|
| 14 |
+
)
|
| 15 |
+
top_p = gr.Slider(minimum=0, maximum=1, step=0.01, value=0.8, label="Top P")
|
| 16 |
+
top_k = gr.Slider(minimum=0, maximum=1000, step=1, value=100, label="Top K")
|
| 17 |
+
max_new_tokens = gr.Slider(minimum=1, maximum=4096, step=1, value=512, label="Max Tokens")
|
| 18 |
|
| 19 |
# Output for the interface
|
| 20 |
response = gr.Textbox(label="Predicted answer", show_label=True, show_copy_button=True)
|
|
|
|
| 24 |
[
|
| 25 |
"./videos/sample_video_1.mp4",
|
| 26 |
"Here are some frames of a video. Describe this video in detail.",
|
| 27 |
+
0.7,
|
| 28 |
+
0.8,
|
| 29 |
+
100,
|
| 30 |
+
512,
|
| 31 |
],
|
| 32 |
[
|
| 33 |
"./videos/sample_video_2.mp4",
|
| 34 |
"¿Cuál es el animal de este vídeo? ¿Cuantos animales hay?",
|
| 35 |
+
0.7,
|
| 36 |
+
0.8,
|
| 37 |
+
100,
|
| 38 |
+
512,
|
| 39 |
+
],
|
| 40 |
+
[
|
| 41 |
+
"./videos/sample_video_3.mp4",
|
| 42 |
+
"Que se passe-t-il dans cette vidéo ?",
|
| 43 |
+
0.7,
|
| 44 |
+
0.8,
|
| 45 |
+
100,
|
| 46 |
+
512,
|
| 47 |
],
|
|
|
|
| 48 |
]
|
| 49 |
|
| 50 |
# Title, description, and article for the interface
|
|
|
|
| 56 |
# Launch the interface
|
| 57 |
interface = gr.Interface(
|
| 58 |
fn=describe_video,
|
| 59 |
+
inputs=[video, query, temperature, top_p, top_k, max_new_tokens],
|
| 60 |
outputs=response,
|
| 61 |
examples=examples,
|
| 62 |
cache_examples=True,
|