|
|
|
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) |
|
|
|
|
|
if __name__ == "__main__": |
|
demo.launch() |
|
|