Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -3,7 +3,7 @@ import random
|
|
| 3 |
from huggingface_hub import InferenceClient
|
| 4 |
|
| 5 |
|
| 6 |
-
client = InferenceClient("
|
| 7 |
def respond(message, history):
|
| 8 |
messages = [{"role": "system", "content": "You are a friendly chatbot."}]
|
| 9 |
if history:
|
|
@@ -11,7 +11,7 @@ def respond(message, history):
|
|
| 11 |
messages.append({"role":"user", "content": message})
|
| 12 |
response = client.chat_completion(
|
| 13 |
messages,
|
| 14 |
-
max_tokens = 100
|
| 15 |
)
|
| 16 |
print(response["choices"][0]["message"]["content"].strip())
|
| 17 |
return response["choices"][0]["message"]["content"].strip()
|
|
@@ -21,4 +21,4 @@ def echo(message, history):
|
|
| 21 |
response = random.choice(choices)
|
| 22 |
return response
|
| 23 |
chatbot = gr.ChatInterface(respond, type = "messages")
|
| 24 |
-
chatbot.launch()
|
|
|
|
| 3 |
from huggingface_hub import InferenceClient
|
| 4 |
|
| 5 |
|
| 6 |
+
client = InferenceClient("Qwen/Qwen2.5-72B-Instruct") #change the LLM
|
| 7 |
def respond(message, history):
|
| 8 |
messages = [{"role": "system", "content": "You are a friendly chatbot."}]
|
| 9 |
if history:
|
|
|
|
| 11 |
messages.append({"role":"user", "content": message})
|
| 12 |
response = client.chat_completion(
|
| 13 |
messages,
|
| 14 |
+
max_tokens = 100 #change the length
|
| 15 |
)
|
| 16 |
print(response["choices"][0]["message"]["content"].strip())
|
| 17 |
return response["choices"][0]["message"]["content"].strip()
|
|
|
|
| 21 |
response = random.choice(choices)
|
| 22 |
return response
|
| 23 |
chatbot = gr.ChatInterface(respond, type = "messages")
|
| 24 |
+
chatbot.launch(debug=True)
|