ahmer64 commited on
Commit
efee03e
·
verified ·
1 Parent(s): d55a7bb

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -5
app.py CHANGED
@@ -17,10 +17,13 @@ class BasicAgent:
17
  def __init__(self):
18
  print("Smart Agent initialized.")
19
 
 
 
 
20
  self.model = InferenceClientModel(
21
- model_id="Qwen/Qwen2.5-Coder-32B-Instruct",
22
  provider="hf-inference",
23
- token=os.getenv("Sayyid")
24
  )
25
 
26
  self.agent = CodeAgent(
@@ -39,7 +42,7 @@ Answer the question exactly.
39
  Rules:
40
  - Return only the final answer.
41
  - Do not explain.
42
- - Do not include "FINAL ANSWER".
43
  - No extra words.
44
  - Keep the answer exact and concise.
45
 
@@ -47,8 +50,12 @@ Question:
47
  {question}
48
  """
49
 
50
- answer = self.agent.run(prompt)
51
- return str(answer).strip()
 
 
 
 
52
 
53
 
54
  def run_and_submit_all( profile: gr.OAuthProfile | None):
 
17
  def __init__(self):
18
  print("Smart Agent initialized.")
19
 
20
+ hf_token = os.getenv("Sayyid")
21
+ print("TOKEN EXISTS:", hf_token is not None)
22
+
23
  self.model = InferenceClientModel(
24
+ model_id="HuggingFaceH4/zephyr-7b-beta",
25
  provider="hf-inference",
26
+ token=hf_token
27
  )
28
 
29
  self.agent = CodeAgent(
 
42
  Rules:
43
  - Return only the final answer.
44
  - Do not explain.
45
+ - Do not include FINAL ANSWER.
46
  - No extra words.
47
  - Keep the answer exact and concise.
48
 
 
50
  {question}
51
  """
52
 
53
+ try:
54
+ answer = self.agent.run(prompt)
55
+ return str(answer).strip()
56
+ except Exception as e:
57
+ print("AGENT ERROR:", e)
58
+ return "error"
59
 
60
 
61
  def run_and_submit_all( profile: gr.OAuthProfile | None):