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()