Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -12,18 +12,12 @@ def respond(message, history):
|
|
| 12 |
|
| 13 |
messages.append({"role": "user", "content": message})
|
| 14 |
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
except Exception as e:
|
| 22 |
-
reply = f"Error during inference: {e}"
|
| 23 |
-
# Optionally log the error
|
| 24 |
-
print(reply)
|
| 25 |
-
|
| 26 |
-
return reply
|
| 27 |
|
| 28 |
chatbot = gr.ChatInterface(respond, type="messages")
|
| 29 |
|
|
|
|
| 12 |
|
| 13 |
messages.append({"role": "user", "content": message})
|
| 14 |
|
| 15 |
+
response = client.chat_completion(
|
| 16 |
+
messages,
|
| 17 |
+
max_tokens=512,
|
| 18 |
+
)
|
| 19 |
+
|
| 20 |
+
return response['choices'][0]['message']['content'].strip()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
|
| 22 |
chatbot = gr.ChatInterface(respond, type="messages")
|
| 23 |
|