File size: 438 Bytes
1cd2280
 
051ddda
1cd2280
 
051ddda
 
 
 
 
 
 
 
 
1cd2280
 
051ddda
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import gradio as gr

def chat_fn(message, history):
    reply = "You said: " + message
    history = history + [[message, reply]]
    return "", history

with gr.Blocks() as demo:
    chatbot = gr.Chatbot(height=450)
    msg = gr.Textbox(placeholder="Type here...", label=None)
    clear = gr.Button("Clear")

    msg.submit(chat_fn, [msg, chatbot], [msg, chatbot])
    clear.click(lambda: ("", []), None, [msg, chatbot])

demo.launch()