Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -15,20 +15,20 @@ from huggingface_hub import InferenceClient
|
|
| 15 |
client = InferenceClient("Qwen/Qwen2.5-7B-Instruct")
|
| 16 |
|
| 17 |
def respond(message, history):
|
| 18 |
-
messages = [{"role": "system", "content": "You are a friendly chatbot
|
| 19 |
|
| 20 |
if history:
|
| 21 |
messages.extend(history)
|
| 22 |
|
| 23 |
messages.append({"role": "user", "content": message})
|
| 24 |
-
|
| 25 |
response = client.chat_completion (
|
| 26 |
messages,
|
| 27 |
-
max_tokens
|
| 28 |
)
|
| 29 |
|
| 30 |
return response.choices[0].message.content.strip()
|
| 31 |
|
| 32 |
-
|
| 33 |
chatbot = gr.ChatInterface(respond)
|
|
|
|
| 34 |
chatbot.launch()
|
|
|
|
| 15 |
client = InferenceClient("Qwen/Qwen2.5-7B-Instruct")
|
| 16 |
|
| 17 |
def respond(message, history):
|
| 18 |
+
messages = [{"role" : "system", "content": "You are a friendly chatbot"}]
|
| 19 |
|
| 20 |
if history:
|
| 21 |
messages.extend(history)
|
| 22 |
|
| 23 |
messages.append({"role": "user", "content": message})
|
| 24 |
+
|
| 25 |
response = client.chat_completion (
|
| 26 |
messages,
|
| 27 |
+
max_tokens=100
|
| 28 |
)
|
| 29 |
|
| 30 |
return response.choices[0].message.content.strip()
|
| 31 |
|
|
|
|
| 32 |
chatbot = gr.ChatInterface(respond)
|
| 33 |
+
|
| 34 |
chatbot.launch()
|