Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -67,13 +67,18 @@ class SmartAgent:
|
|
| 67 |
self.hf_token = os.getenv("HF_TOKEN")
|
| 68 |
if not self.hf_token:
|
| 69 |
raise ValueError("HF_TOKEN environment variable not set!")
|
| 70 |
-
|
| 71 |
-
self.
|
| 72 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 73 |
|
| 74 |
def call_llm(self, messages: list) -> str:
|
| 75 |
payload = {
|
| 76 |
-
"model":
|
| 77 |
"messages": messages,
|
| 78 |
"max_tokens": 1024,
|
| 79 |
"temperature": 0.1,
|
|
@@ -230,7 +235,7 @@ with gr.Blocks() as demo:
|
|
| 230 |
**Powered by Qwen2.5-72B via HuggingFace Inference API (FREE)**
|
| 231 |
|
| 232 |
**Instructions:**
|
| 233 |
-
1. Make sure `HF_TOKEN` is set in your Space secrets
|
| 234 |
2. Log in with your Hugging Face account below
|
| 235 |
3. Click **Run Evaluation & Submit All Answers**
|
| 236 |
"""
|
|
|
|
| 67 |
self.hf_token = os.getenv("HF_TOKEN")
|
| 68 |
if not self.hf_token:
|
| 69 |
raise ValueError("HF_TOKEN environment variable not set!")
|
| 70 |
+
# Use HF Inference Providers (new format)
|
| 71 |
+
self.api_url = "https://api-inference.huggingface.co/v1/chat/completions"
|
| 72 |
+
self.model = "Qwen/Qwen2.5-72B-Instruct"
|
| 73 |
+
self.headers = {
|
| 74 |
+
"Authorization": f"Bearer {self.hf_token}",
|
| 75 |
+
"Content-Type": "application/json"
|
| 76 |
+
}
|
| 77 |
+
print(f"SmartAgent initialized with {self.model} (HF Inference API - FREE)")
|
| 78 |
|
| 79 |
def call_llm(self, messages: list) -> str:
|
| 80 |
payload = {
|
| 81 |
+
"model": self.model,
|
| 82 |
"messages": messages,
|
| 83 |
"max_tokens": 1024,
|
| 84 |
"temperature": 0.1,
|
|
|
|
| 235 |
**Powered by Qwen2.5-72B via HuggingFace Inference API (FREE)**
|
| 236 |
|
| 237 |
**Instructions:**
|
| 238 |
+
1. Make sure `HF_TOKEN` is set in your Space secrets
|
| 239 |
2. Log in with your Hugging Face account below
|
| 240 |
3. Click **Run Evaluation & Submit All Answers**
|
| 241 |
"""
|