Spaces:
Running
on
Zero
Running
on
Zero
macadeliccc
commited on
Commit
·
0e4adfe
1
Parent(s):
3fbf6d6
test
Browse files
app.py
CHANGED
@@ -37,7 +37,7 @@ def is_server_up(url):
|
|
37 |
return False
|
38 |
|
39 |
# Function to send a message to the ochat server and get a response
|
40 |
-
|
41 |
base_url = "http://localhost:18888"
|
42 |
chat_url = f"{base_url}/v1/chat/completions"
|
43 |
headers = {"Content-Type": "application/json"}
|
@@ -84,8 +84,10 @@ with gr.Blocks(theme=gr.themes.Soft()) as app:
|
|
84 |
history[-1][1] = bot_response # Update the last entry with the bot's response
|
85 |
return history
|
86 |
|
87 |
-
message.submit(user, [message, chatbot], [message, chatbot], queue=
|
88 |
bot, chatbot, chatbot
|
89 |
)
|
90 |
clear.click(lambda: None, None, chatbot, queue=False)
|
|
|
|
|
91 |
app.launch()
|
|
|
37 |
return False
|
38 |
|
39 |
# Function to send a message to the ochat server and get a response
|
40 |
+
def chat_with_ochat(message):
|
41 |
base_url = "http://localhost:18888"
|
42 |
chat_url = f"{base_url}/v1/chat/completions"
|
43 |
headers = {"Content-Type": "application/json"}
|
|
|
84 |
history[-1][1] = bot_response # Update the last entry with the bot's response
|
85 |
return history
|
86 |
|
87 |
+
message.submit(user, [message, chatbot], [message, chatbot], queue=True).then(
|
88 |
bot, chatbot, chatbot
|
89 |
)
|
90 |
clear.click(lambda: None, None, chatbot, queue=False)
|
91 |
+
|
92 |
+
app.queue()
|
93 |
app.launch()
|