Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -3,10 +3,11 @@ import random
|
|
| 3 |
from huggingface_hub import InferenceClient
|
| 4 |
|
| 5 |
client = InferenceClient("HuggingFaceH4/zephyr-7b-beta")
|
|
|
|
| 6 |
|
| 7 |
def respond(message, history):
|
| 8 |
|
| 9 |
-
messages = [{"role": "system", "content": "You are a friendly chatbot."}]
|
| 10 |
|
| 11 |
if history:
|
| 12 |
messages.extend(history)
|
|
@@ -14,6 +15,7 @@ def respond(message, history):
|
|
| 14 |
messages.append({"role":"user", "content": message})
|
| 15 |
|
| 16 |
response = client.chat_completion(messages, max_tokens=100)
|
|
|
|
| 17 |
|
| 18 |
print(response['choices'][0]['message']['content'].strip())
|
| 19 |
|
|
|
|
| 3 |
from huggingface_hub import InferenceClient
|
| 4 |
|
| 5 |
client = InferenceClient("HuggingFaceH4/zephyr-7b-beta")
|
| 6 |
+
#change the LLM
|
| 7 |
|
| 8 |
def respond(message, history):
|
| 9 |
|
| 10 |
+
messages = [{"role": "system", "content": "You are a friendly chatbot."}] #change the personality
|
| 11 |
|
| 12 |
if history:
|
| 13 |
messages.extend(history)
|
|
|
|
| 15 |
messages.append({"role":"user", "content": message})
|
| 16 |
|
| 17 |
response = client.chat_completion(messages, max_tokens=100)
|
| 18 |
+
# change length using max_tokens
|
| 19 |
|
| 20 |
print(response['choices'][0]['message']['content'].strip())
|
| 21 |
|