Spaces:
Sleeping
Sleeping
added comments
Browse files
app.py
CHANGED
|
@@ -3,16 +3,19 @@ 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 |
if history:
|
| 11 |
messages.extend(history)
|
| 12 |
|
| 13 |
messages.append({"role" : "user", "content" : message})
|
| 14 |
|
| 15 |
response = client.chat_completion(messages, max_tokens = 100)
|
|
|
|
| 16 |
|
| 17 |
print(response["choices"][0]["message"]["content"].strip())
|
| 18 |
|
|
|
|
| 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."}]
|
| 11 |
+
# change the personality of the chatbot
|
| 12 |
if history:
|
| 13 |
messages.extend(history)
|
| 14 |
|
| 15 |
messages.append({"role" : "user", "content" : message})
|
| 16 |
|
| 17 |
response = client.chat_completion(messages, max_tokens = 100)
|
| 18 |
+
# change the length of the response
|
| 19 |
|
| 20 |
print(response["choices"][0]["message"]["content"].strip())
|
| 21 |
|