Washedashore commited on
Commit
5f9eafb
·
verified ·
1 Parent(s): 8bd1cd2

create usage

Browse files

import gradio as gr
from gradio_multimodalchatbot import MultimodalChatbot
from gradio.data_classes import FileData

user_msg1 = {"text": "Hello, what is in this image?",
"files": [{"file": FileData(path="https://gradio-builds.s3.amazonaws.com/diffusion_image/cute_dog.jpg")}]
}
bot_msg1 = {"text": "It is a very cute dog",
"files": []}

user_msg2 = {"text": "Describe this audio clip please.",
"files": [{"file": FileData(path="cantina.wav")}]}
bot_msg2 = {"text": "It is the cantina song from Star Wars",
"files": []}

user_msg3 = {"text": "Give me a video clip please.",
"files": []}
bot_msg3 = {"text": "Here is a video clip of the world",
"files": [{"file": FileData(path="world.mp4")},
{"file": FileData(path="cantina.wav")}]}

conversation = [[user_msg1, bot_msg1], [user_msg2, bot_msg2], [user_msg3, bot_msg3]]

with gr.Blocks() as demo:
MultimodalChatbot(value=conversation, height=800)

Files changed (1) hide show
  1. usage +25 -0
usage ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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)