likki1715 commited on
Commit
49c8ecf
·
verified ·
1 Parent(s): 83e5347

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -5
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
- self.api_url = "https://api-inference.huggingface.co/models/Qwen/Qwen2.5-72B-Instruct/v1/chat/completions"
71
- self.headers = {"Authorization": f"Bearer {self.hf_token}"}
72
- print("SmartAgent initialized with Qwen2.5-72B (HF Inference API - FREE)")
 
 
 
 
 
73
 
74
  def call_llm(self, messages: list) -> str:
75
  payload = {
76
- "model": "Qwen/Qwen2.5-72B-Instruct",
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 (your HF access token)
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
  """