Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -74,32 +74,32 @@ with demo:
|
|
| 74 |
response += char
|
| 75 |
yield [(f"π€ Response from LLM: {chat_model_selection}", response)] # Correct format for Gradio Chatbot
|
| 76 |
#
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
|
| 104 |
with gr.Tabs(elem_classes="tab-buttons") as tabs:
|
| 105 |
with gr.TabItem("π LLM Leadeboard", elem_id="llm-benchmark-table", id=0):
|
|
|
|
| 74 |
response += char
|
| 75 |
yield [(f"π€ Response from LLM: {chat_model_selection}", response)] # Correct format for Gradio Chatbot
|
| 76 |
#
|
| 77 |
+
with gr.Blocks() as chat_interface:
|
| 78 |
+
chatbot = gr.Chatbot()
|
| 79 |
+
msg = gr.Textbox()
|
| 80 |
+
submit = gr.Button("Submit")
|
| 81 |
+
clear = gr.Button("Clear")
|
| 82 |
+
|
| 83 |
+
def user(user_message, history):
|
| 84 |
+
return "", history + [[user_message, None]]
|
| 85 |
+
|
| 86 |
+
def clear_chat(*args):
|
| 87 |
+
return [] # Returning an empty list to signify clearing the chat, adjust as per Gradio's capabilities
|
| 88 |
+
|
| 89 |
+
submit.click(
|
| 90 |
+
fn=get_response,
|
| 91 |
+
inputs=[msg, chatbot],
|
| 92 |
+
outputs=chatbot
|
| 93 |
+
)
|
| 94 |
+
|
| 95 |
+
clear.click(
|
| 96 |
+
fn=clear_chat,
|
| 97 |
+
inputs=None,
|
| 98 |
+
outputs=chatbot
|
| 99 |
+
)
|
| 100 |
+
|
| 101 |
+
chat_interface.queue()
|
| 102 |
+
chat_interface.launch()
|
| 103 |
|
| 104 |
with gr.Tabs(elem_classes="tab-buttons") as tabs:
|
| 105 |
with gr.TabItem("π LLM Leadeboard", elem_id="llm-benchmark-table", id=0):
|