Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -3,6 +3,7 @@ from huggingface_hub import InferenceClient
|
|
| 3 |
import random
|
| 4 |
|
| 5 |
client = InferenceClient("HuggingFaceH4/zephyr-7b-beta")
|
|
|
|
| 6 |
|
| 7 |
#def echo(message, history):
|
| 8 |
#choices = ["Ask me later", "Not today, sweetie", "One day we'll know", "Indeed!", "Nahhhh the vibes off cuh", "Cro don't do it", "Oh skibidi", "Ts pmo icl", "All of this is fake", "YES GET IT GURL"]
|
|
@@ -11,16 +12,18 @@ client = InferenceClient("HuggingFaceH4/zephyr-7b-beta")
|
|
| 11 |
|
| 12 |
def respond(message, history):
|
| 13 |
messages = [{"role": "system", "content": "You are a friendly chatbot."}]
|
|
|
|
| 14 |
if history:
|
| 15 |
messages.extend(history)
|
| 16 |
#adds multiple value + types rather than just one
|
| 17 |
messages.append({"role": "user", "content": message})
|
| 18 |
response = client.chat_completion(messages, max_tokens=100)
|
|
|
|
| 19 |
print(response)
|
| 20 |
return response['choices'][0]['message']['content'].strip()
|
| 21 |
|
| 22 |
chatbot = gr.ChatInterface(respond, type = "messages")
|
| 23 |
|
| 24 |
|
| 25 |
-
chatbot.launch()
|
| 26 |
|
|
|
|
| 3 |
import random
|
| 4 |
|
| 5 |
client = InferenceClient("HuggingFaceH4/zephyr-7b-beta")
|
| 6 |
+
#change LLM here
|
| 7 |
|
| 8 |
#def echo(message, history):
|
| 9 |
#choices = ["Ask me later", "Not today, sweetie", "One day we'll know", "Indeed!", "Nahhhh the vibes off cuh", "Cro don't do it", "Oh skibidi", "Ts pmo icl", "All of this is fake", "YES GET IT GURL"]
|
|
|
|
| 12 |
|
| 13 |
def respond(message, history):
|
| 14 |
messages = [{"role": "system", "content": "You are a friendly chatbot."}]
|
| 15 |
+
#change content value to change personality
|
| 16 |
if history:
|
| 17 |
messages.extend(history)
|
| 18 |
#adds multiple value + types rather than just one
|
| 19 |
messages.append({"role": "user", "content": message})
|
| 20 |
response = client.chat_completion(messages, max_tokens=100)
|
| 21 |
+
#change max tokens to a greater number
|
| 22 |
print(response)
|
| 23 |
return response['choices'][0]['message']['content'].strip()
|
| 24 |
|
| 25 |
chatbot = gr.ChatInterface(respond, type = "messages")
|
| 26 |
|
| 27 |
|
| 28 |
+
chatbot.launch(debug=True)
|
| 29 |
|