themissingCRAM
commited on
Commit
·
cca0aa7
1
Parent(s):
d7a9fb6
blocks experiment
Browse files
app.py
CHANGED
|
@@ -129,16 +129,17 @@ if __name__ == "__main__":
|
|
| 129 |
# agent.run("What is the average each customer paid?")
|
| 130 |
# GradioUI(agent).launch()
|
| 131 |
|
| 132 |
-
def enter_message(text
|
| 133 |
print(text)
|
| 134 |
-
|
|
|
|
| 135 |
print(type(x))
|
| 136 |
print(x)
|
|
|
|
| 137 |
|
| 138 |
with gr.Blocks() as b:
|
| 139 |
chatbot = gr.Chatbot(type="messages")
|
| 140 |
-
|
| 141 |
input = gr.Textbox()
|
| 142 |
button = gr.Button("reply")
|
| 143 |
-
button.click(enter_message, input, chatbot)
|
| 144 |
b.launch()
|
|
|
|
| 129 |
# agent.run("What is the average each customer paid?")
|
| 130 |
# GradioUI(agent).launch()
|
| 131 |
|
| 132 |
+
def enter_message(text, chat_history):
|
| 133 |
print(text)
|
| 134 |
+
chat_history.append({"role": "user", "content": text})
|
| 135 |
+
x = agent.run(chat_history)
|
| 136 |
print(type(x))
|
| 137 |
print(x)
|
| 138 |
+
return "", x
|
| 139 |
|
| 140 |
with gr.Blocks() as b:
|
| 141 |
chatbot = gr.Chatbot(type="messages")
|
|
|
|
| 142 |
input = gr.Textbox()
|
| 143 |
button = gr.Button("reply")
|
| 144 |
+
button.click(enter_message, [input, chatbot], [input, chatbot])
|
| 145 |
b.launch()
|