|
|
|
import warnings |
|
warnings.filterwarnings("ignore") |
|
|
|
import gradio as gr |
|
from src.app.response import describe_video |
|
|
|
|
|
|
|
video = gr.Video(label="Video") |
|
query = gr.Textbox(label="Question", placeholder="Enter your question here") |
|
|
|
|
|
response = gr.Textbox(label="Predicted answer", show_label=True, show_copy_button=True) |
|
|
|
|
|
examples = [ |
|
[ |
|
"./videos/sample_video_1.mp4", |
|
"Here are some frames of a video. Describe this video in detail.", |
|
], |
|
[ |
|
"./videos/sample_video_2.mp4", |
|
"¿Cuál es el animal de este vídeo? ¿Cuantos animales hay?", |
|
], |
|
["./videos/sample_video_3.mp4", "이 비디오를 설명하라"], |
|
] |
|
|
|
|
|
css = """ |
|
footer { |
|
visibility: hidden; |
|
} |
|
""" |
|
|
|
|
|
|
|
interface = gr.Interface(css=css, |
|
fn=describe_video, |
|
inputs=[video, query], |
|
outputs=response, |
|
examples=examples, |
|
theme="Nymbo/Nymbo_Theme", |
|
allow_flagging="never", |
|
) |
|
interface.launch(debug=False) |
|
|