import numpy as np | |
import gradio as gr | |
def add_text(text, state): | |
state = state + [(text, text + "?")] | |
return state, state | |
with gr.Blocks(css="#chatbot {height: 600px; overflow: auto;}") as demo: | |
chatbot = gr.Chatbot(elem_id = "chatbot") | |
state = gr.State([]) | |
with gr.Row(): | |
txt = gr.Textbox(show_label=False, placeholder="Enter text and press enter").style(container=False) | |
txt.submit(add_text, [txt, state], [chatbot, state]) | |
demo.launch(server_name="0.0.0.0") |