File size: 727 Bytes
8c2c1df
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import gradio as gr
from anton_agent import agent_executor

# print(agent_executor.run("waofkaewof"))
# print(agent_executor.run("siapa namamu?"))

def predict(input, history=[]):
    response = agent_executor.run(input)
    history = history + [(input, response)]
    response = history
    # response = [response] 
    # return response, response
    return response, response

with gr.Blocks() as demo:
    chatbot = gr.Chatbot()
    state = gr.State([])

    with gr.Row():
        txt = gr.Textbox(show_label=False, placeholder="Enter text and press enter").style(container=False)

    txt.submit(predict, [txt, state], [chatbot, state])
    # txt.submit(agent_executor.run, [txt, state], [chatbot, state])

demo.launch()