File size: 927 Bytes
c25db33
 
68f9508
293d904
2ebdbe9
293d904
68f9508
 
c25db33
293d904
c25db33
24a3033
c25db33
24a3033
c25db33
 
 
 
 
 
 
92cfa20
293d904
c25db33
 
 
33912bc
7e1bec9
a51b02c
c25db33
cecdd8f
c25db33
293d904
c25db33
 
293d904
c25db33
 
 
 
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import gradio as gr

css="""
#col-container {
    margin: auto;
    max-width: 800px;
}
"""

def bot_response(history, message):
    for x in message["files"]:
        history.append([(x,), None])
    if message["text"] is not None:
        history.append([message["text"], None])
    response = "**That's cool!**"
    history[-1][1] = ""
    for character in response:
        history[-1][1] += character
        yield history


with gr.Blocks(css=css, fill_height=True) as demo:
  with gr.Column(elem_id="col-container"):
    chatbot = gr.Chatbot(
        [],
        elem_id="chatbot",
        bubble_full_width=False,
        height=700,
        )

    chat_input = gr.MultimodalTextbox(interactive=True, file_types=["file"], placeholder="Enter message or upload file...", show_label=False)

  chat_input.submit(bot_response, [chatbot, chat_input], [chatbot,])

demo.queue()

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