Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -80,29 +80,29 @@ with demo:
|
|
| 80 |
if char == '<': # This is stopping condition; adjust as needed.
|
| 81 |
break
|
| 82 |
response += char
|
| 83 |
-
|
| 84 |
#
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
|
| 106 |
chat_interface.launch()
|
| 107 |
|
| 108 |
with gr.Tabs(elem_classes="tab-buttons") as tabs:
|
|
|
|
| 80 |
if char == '<': # This is stopping condition; adjust as needed.
|
| 81 |
break
|
| 82 |
response += char
|
| 83 |
+
yield [(f"🤖 Response from LLM: {chat_model_selection}", response)] # Correct format for Gradio Chatbot
|
| 84 |
#
|
| 85 |
+
|
| 86 |
+
chatbot = gr.Chatbot()
|
| 87 |
+
msg = gr.Textbox()
|
| 88 |
+
submit = gr.Button("Submit")
|
| 89 |
+
clear = gr.Button("Clear")
|
| 90 |
+
def user(user_message, history):
|
| 91 |
+
return "", history + [[user_message, None]]
|
| 92 |
+
def clear_chat(*args):
|
| 93 |
+
return [] # Returning an empty list to signify clearing the chat, adjust as per Gradio's capabilities
|
| 94 |
+
submit.click(
|
| 95 |
+
fn=get_response,
|
| 96 |
+
inputs=[msg, chatbot],
|
| 97 |
+
outputs=chatbot
|
| 98 |
+
)
|
| 99 |
+
clear.click(
|
| 100 |
+
fn=clear_chat,
|
| 101 |
+
inputs=None,
|
| 102 |
+
outputs=chatbot
|
| 103 |
+
)
|
| 104 |
+
|
| 105 |
+
_interface.queue()
|
| 106 |
chat_interface.launch()
|
| 107 |
|
| 108 |
with gr.Tabs(elem_classes="tab-buttons") as tabs:
|