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