Spaces:
Sleeping
Sleeping
now playing around with parameters
Browse files
app.py
CHANGED
|
@@ -4,7 +4,6 @@ from huggingface_hub import InferenceClient
|
|
| 4 |
client = InferenceClient("HuggingFaceH4/zephyr-7b-beta")
|
| 5 |
|
| 6 |
def respond(message, history):
|
| 7 |
-
|
| 8 |
messages = [{"role": "system", "content": "You are a friendly chatbot."}]
|
| 9 |
|
| 10 |
if history:
|
|
@@ -14,12 +13,19 @@ def respond(message, history):
|
|
| 14 |
|
| 15 |
response = client.chat_completion(
|
| 16 |
messages,
|
| 17 |
-
max_tokens=
|
|
|
|
|
|
|
| 18 |
)
|
| 19 |
|
| 20 |
return response['choices'][0]['message']['content'].strip()
|
| 21 |
|
| 22 |
-
chatbot = gr.ChatInterface(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 23 |
|
| 24 |
chatbot.launch()
|
| 25 |
|
|
|
|
| 4 |
client = InferenceClient("HuggingFaceH4/zephyr-7b-beta")
|
| 5 |
|
| 6 |
def respond(message, history):
|
|
|
|
| 7 |
messages = [{"role": "system", "content": "You are a friendly chatbot."}]
|
| 8 |
|
| 9 |
if history:
|
|
|
|
| 13 |
|
| 14 |
response = client.chat_completion(
|
| 15 |
messages,
|
| 16 |
+
max_tokens=150, # Increased for longer responses
|
| 17 |
+
temperature=0.7, # Medium randomness
|
| 18 |
+
top_p=0.9 # Keeps responses reasonably diverse
|
| 19 |
)
|
| 20 |
|
| 21 |
return response['choices'][0]['message']['content'].strip()
|
| 22 |
|
| 23 |
+
chatbot = gr.ChatInterface(
|
| 24 |
+
respond,
|
| 25 |
+
type="messages",
|
| 26 |
+
title="Dynamic Chatbot",
|
| 27 |
+
description="A friendly chatbot with more dynamic and creative responses!"
|
| 28 |
+
)
|
| 29 |
|
| 30 |
chatbot.launch()
|
| 31 |
|