Spaces:
Running
on
Zero
Running
on
Zero
File size: 1,674 Bytes
9fd9702 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# Importing the requirements
# import warnings
# warnings.filterwarnings("ignore")
import gradio as gr
from src.model import describe_video
# Video and text inputs for the interface
video = gr.Video(label="Video")
query = gr.Textbox(label="Query", placeholder="Type your query here")
# Output for the interface
response = gr.Textbox(label="Response", show_label=True, show_copy_button=True)
# Examples for the interface
examples = [
[
"./videos/sample_video_1.mp4",
"Here are some frames of a video. Describe this video in detail",
],
[
"./videos/sample_video_2.mp4",
"Which are the animals in this video, and how many are there?",
],
["./videos/sample_video_3.mp4", "What is happening in this video?"],
]
# Title, description, and article for the interface
title = "Video Understanding & Question Answering"
description = "This Gradio demo uses the MiniCPM-V-2_6 model for video understanding tasks. Upload a video and type a question to get a detailed description or specific information from the video."
article = "<p style='text-align: center'><a href='https://arxiv.org/abs/2407.03320' target='_blank'>InternLM-XComposer-2.5: A Versatile Large Vision Language Model Supporting Long-Contextual Input and Output</a> | <a href='https://huggingface.co/internlm/internlm-xcomposer2d5-7b' target='_blank'>Model Page</a></p>"
# Launch the interface
interface = gr.Interface(
fn=describe_video,
inputs=[video, query],
outputs=response,
examples=examples,
title=title,
description=description,
article=article,
theme="Soft",
allow_flagging="never",
)
interface.launch(debug=False)
|