File size: 500 Bytes
acc4ffe
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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")