Spaces:
Sleeping
Sleeping
Changed debugging to true and added comments
Browse files
app.py
CHANGED
|
@@ -3,6 +3,7 @@ import random
|
|
| 3 |
from huggingface_hub import InferenceClient
|
| 4 |
|
| 5 |
client = InferenceClient("HuggingFaceH4/zephyr-7b-beta")
|
|
|
|
| 6 |
|
| 7 |
def respond(message, history):
|
| 8 |
|
|
@@ -12,8 +13,12 @@ def respond(message, history):
|
|
| 12 |
|
| 13 |
messages.append({"role" : "user", "content" : message})
|
| 14 |
|
| 15 |
-
response = client.chat_completion(
|
| 16 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
print(response["choices"][0]["message"]["content"].strip())
|
| 18 |
|
| 19 |
|
|
@@ -26,4 +31,4 @@ def random_message(message, history):
|
|
| 26 |
|
| 27 |
chatbot = gr.ChatInterface(respond, type = "messages", description = "<strong><center>Don't talk to me please.</strong><br>go away.", title = "I'm not a chatbot")
|
| 28 |
|
| 29 |
-
chatbot.launch()
|
|
|
|
| 3 |
from huggingface_hub import InferenceClient
|
| 4 |
|
| 5 |
client = InferenceClient("HuggingFaceH4/zephyr-7b-beta")
|
| 6 |
+
# change LLM ^
|
| 7 |
|
| 8 |
def respond(message, history):
|
| 9 |
|
|
|
|
| 13 |
|
| 14 |
messages.append({"role" : "user", "content" : message})
|
| 15 |
|
| 16 |
+
response = client.chat_completion(
|
| 17 |
+
messages,
|
| 18 |
+
max_tokens = 100
|
| 19 |
+
#change the length
|
| 20 |
+
)
|
| 21 |
+
|
| 22 |
print(response["choices"][0]["message"]["content"].strip())
|
| 23 |
|
| 24 |
|
|
|
|
| 31 |
|
| 32 |
chatbot = gr.ChatInterface(respond, type = "messages", description = "<strong><center>Don't talk to me please.</strong><br>go away.", title = "I'm not a chatbot")
|
| 33 |
|
| 34 |
+
chatbot.launch(debug=True)
|