Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -34,6 +34,8 @@ def update_bot(text, chatbot):
|
|
| 34 |
def new_chat():
|
| 35 |
interpreter.messages = []
|
| 36 |
return [], ""
|
|
|
|
|
|
|
| 37 |
def create_chat_widget():
|
| 38 |
with gr.Blocks() as chatblock:
|
| 39 |
chatbot = gr.Chatbot(
|
|
@@ -45,20 +47,13 @@ def create_chat_widget():
|
|
| 45 |
height=600,
|
| 46 |
)
|
| 47 |
txt = gr.Textbox(
|
| 48 |
-
scale=4,
|
| 49 |
-
show_label=False,
|
| 50 |
placeholder="Enter text and press enter to chat with the bot.",
|
| 51 |
-
|
| 52 |
-
)
|
| 53 |
-
new_chat_button = gr.Button(
|
| 54 |
-
"New Chat",
|
| 55 |
-
scale=3,
|
| 56 |
-
interactive=True,
|
| 57 |
)
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
return chatblock
|
| 63 |
|
| 64 |
def json_to_markdown(json_data):
|
|
|
|
| 34 |
def new_chat():
|
| 35 |
interpreter.messages = []
|
| 36 |
return [], ""
|
| 37 |
+
|
| 38 |
+
|
| 39 |
def create_chat_widget():
|
| 40 |
with gr.Blocks() as chatblock:
|
| 41 |
chatbot = gr.Chatbot(
|
|
|
|
| 47 |
height=600,
|
| 48 |
)
|
| 49 |
txt = gr.Textbox(
|
|
|
|
|
|
|
| 50 |
placeholder="Enter text and press enter to chat with the bot.",
|
| 51 |
+
show_label=False,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 52 |
)
|
| 53 |
+
send_button = gr.Button("Send")
|
| 54 |
+
with gr.Row():
|
| 55 |
+
txt.submit(update_bot, inputs=[txt, chatbot], outputs=[chatbot, txt])
|
| 56 |
+
send_button.click(update_bot, inputs=[txt, chatbot], outputs=[chatbot, txt])
|
| 57 |
return chatblock
|
| 58 |
|
| 59 |
def json_to_markdown(json_data):
|