Spaces:
Sleeping
Sleeping
add os.
Browse files
app.py
CHANGED
|
@@ -1,13 +1,20 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
import random
|
|
|
|
| 3 |
from huggingface_hub import InferenceClient
|
| 4 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
client=InferenceClient("Qwen/Qwen2.5-7B-Instruct")
|
| 6 |
|
| 7 |
def respond(message, history):
|
| 8 |
messages=[{"role": "system", "content": "You're a friendly chatbot!"}]
|
| 9 |
|
| 10 |
-
|
|
|
|
| 11 |
|
| 12 |
messages.append({"role": "user", "content": message})
|
| 13 |
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
import random
|
| 3 |
+
import os
|
| 4 |
from huggingface_hub import InferenceClient
|
| 5 |
|
| 6 |
+
client = InferenceClient(
|
| 7 |
+
model="Qwen/Qwen2.5-7B-Instruct",
|
| 8 |
+
token=os.getenv("HF_TOKEN")
|
| 9 |
+
)
|
| 10 |
+
|
| 11 |
client=InferenceClient("Qwen/Qwen2.5-7B-Instruct")
|
| 12 |
|
| 13 |
def respond(message, history):
|
| 14 |
messages=[{"role": "system", "content": "You're a friendly chatbot!"}]
|
| 15 |
|
| 16 |
+
if history:
|
| 17 |
+
messages.extend(history)
|
| 18 |
|
| 19 |
messages.append({"role": "user", "content": message})
|
| 20 |
|