Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -9,18 +9,15 @@ client = InferenceClient("microsoft/phi-4")
|
|
| 9 |
|
| 10 |
def respond(message, history):
|
| 11 |
messages = [{"role": "system", "content": "You are a friendly chatbot"}]
|
| 12 |
-
|
| 13 |
-
if history:
|
| 14 |
-
messages.extend(history)
|
| 15 |
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
|
|
|
| 21 |
)
|
| 22 |
-
|
| 23 |
-
return response['choices'][0]['message']['content'].strip()
|
| 24 |
|
| 25 |
|
| 26 |
#def echo(message, history):
|
|
|
|
| 9 |
|
| 10 |
def respond(message, history):
|
| 11 |
messages = [{"role": "system", "content": "You are a friendly chatbot"}]
|
|
|
|
|
|
|
|
|
|
| 12 |
|
| 13 |
+
if history:
|
| 14 |
+
messages.extend(history)
|
| 15 |
+
messages.append({"role": "user", "content": message})
|
| 16 |
+
response = client.chat_completion(
|
| 17 |
+
messages,
|
| 18 |
+
max_tokens=100
|
| 19 |
)
|
| 20 |
+
return response['choices'][0]['message']['content'].strip()
|
|
|
|
| 21 |
|
| 22 |
|
| 23 |
#def echo(message, history):
|