File size: 590 Bytes
e80a7db
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/usr/bin/env python

import gradio as gr


def run(message, history):
    return message["text"]


examples = [
    {"text": "hey", "files": ["cats.jpg"]},
    {"text": "hello", "files": ["dogs.jpg"]},
]

chatbot = gr.ChatInterface(fn=run, multimodal=True, examples=examples, cache_examples=False)

with gr.Blocks(fill_height=True) as demo:
    chatbot.render()
    chatbot.examples_handler.load_input_event.then(
        fn=lambda: [[], [], None],
        outputs=[chatbot.chatbot, chatbot.chatbot_state, chatbot.saved_input],
    )

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