File size: 550 Bytes
62e2788
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
from pathlib import Path
import gradio as gr

image = str(Path(__file__).parent / "files" / "avatar.png")
audio = str(Path(__file__).parent / "files" / "cantina.wav")

def echo(message, history):
    return f"You wrote: {message['text']} and uploaded {len(message['files'])} files."

demo = gr.ChatInterface(
    fn=echo,
    type="messages",
    examples=[{"text": "hello"}, {"text": "hola", "files": [image]}, {"text": "merhaba", "files": [image, audio]}],
    title="Echo Bot",
    multimodal=True,
)

if __name__ == "__main__":
    demo.launch()