hailiang shi commited on
Commit
8486921
1 Parent(s): e7d41ed

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +28 -0
app.py ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from gradio_multimodalchatbot import MultimodalChatbot
3
+ from gradio.data_classes import FileData
4
+
5
+ user_msg1 = {"text": "Hello, what is in this image?",
6
+ "files": [{"file": FileData(path="https://gradio-builds.s3.amazonaws.com/diffusion_image/cute_dog.jpg")}]
7
+ }
8
+ bot_msg1 = {"text": "It is a very cute dog",
9
+ "files": []}
10
+
11
+ user_msg2 = {"text": "Describe this audio clip please.",
12
+ "files": [{"file": FileData(path="cantina.wav")}]}
13
+ bot_msg2 = {"text": "It is the cantina song from Star Wars",
14
+ "files": []}
15
+
16
+ user_msg3 = {"text": "Give me a video clip please.",
17
+ "files": []}
18
+ bot_msg3 = {"text": "Here is a video clip of the world",
19
+ "files": [{"file": FileData(path="world.mp4")},
20
+ {"file": FileData(path="cantina.wav")}]}
21
+
22
+ conversation = [[user_msg1, bot_msg1], [user_msg2, bot_msg2], [user_msg3, bot_msg3]]
23
+
24
+ with gr.Blocks() as demo:
25
+ MultimodalChatbot(value=conversation, height=800)
26
+
27
+
28
+ demo.launch()