sitammeur commited on
Commit
9fd9702
1 Parent(s): bfaf6f1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +48 -48
app.py CHANGED
@@ -1,48 +1,48 @@
1
- # Importing the requirements
2
- # import warnings
3
-
4
- # warnings.filterwarnings("ignore")
5
-
6
- import gradio as gr
7
- from src.model import describe_video
8
-
9
-
10
- # Video and text inputs for the interface
11
- video = gr.Video(type="file", label="Video")
12
- query = gr.Textbox(label="Query", placeholder="Type your query here")
13
-
14
- # Output for the interface
15
- response = gr.Textbox(label="Response", show_label=True, show_copy_button=True)
16
-
17
- # Examples for the interface
18
- examples = [
19
- [
20
- "./videos/sample_video_1.mp4",
21
- "Here are some frames of a video. Describe this video in detail",
22
- ],
23
- [
24
- "./videos/sample_video_2.mp4",
25
- "Which are the animals in this video, and how many are there?",
26
- ],
27
- ["./videos/sample_video_3.mp4", "What is happening in this video?"],
28
- ]
29
-
30
- # Title, description, and article for the interface
31
- title = "Video Understanding & Question Answering"
32
- 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."
33
- 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>"
34
-
35
-
36
- # Launch the interface
37
- interface = gr.Interface(
38
- fn=describe_video,
39
- inputs=[video, query],
40
- outputs=response,
41
- examples=examples,
42
- title=title,
43
- description=description,
44
- article=article,
45
- theme="Soft",
46
- allow_flagging="never",
47
- )
48
- interface.launch(debug=False)
 
1
+ # Importing the requirements
2
+ # import warnings
3
+
4
+ # warnings.filterwarnings("ignore")
5
+
6
+ import gradio as gr
7
+ from src.model import describe_video
8
+
9
+
10
+ # Video and text inputs for the interface
11
+ video = gr.Video(label="Video")
12
+ query = gr.Textbox(label="Query", placeholder="Type your query here")
13
+
14
+ # Output for the interface
15
+ response = gr.Textbox(label="Response", show_label=True, show_copy_button=True)
16
+
17
+ # Examples for the interface
18
+ examples = [
19
+ [
20
+ "./videos/sample_video_1.mp4",
21
+ "Here are some frames of a video. Describe this video in detail",
22
+ ],
23
+ [
24
+ "./videos/sample_video_2.mp4",
25
+ "Which are the animals in this video, and how many are there?",
26
+ ],
27
+ ["./videos/sample_video_3.mp4", "What is happening in this video?"],
28
+ ]
29
+
30
+ # Title, description, and article for the interface
31
+ title = "Video Understanding & Question Answering"
32
+ 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."
33
+ 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>"
34
+
35
+
36
+ # Launch the interface
37
+ interface = gr.Interface(
38
+ fn=describe_video,
39
+ inputs=[video, query],
40
+ outputs=response,
41
+ examples=examples,
42
+ title=title,
43
+ description=description,
44
+ article=article,
45
+ theme="Soft",
46
+ allow_flagging="never",
47
+ )
48
+ interface.launch(debug=False)