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