lopera47 commited on
Commit
61a17e0
·
verified ·
1 Parent(s): b4fdf61

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -6
app.py CHANGED
@@ -46,12 +46,24 @@ class BasicAgent:
46
  )
47
 
48
  def __call__(self, question: str) -> str:
49
- print(f"Agent received question (first 50 chars): {question[:50]}...")
50
- # Run the agent to get the answer
51
- answer = self.agent.run(question)
52
- print(f"Agent returning answer: {answer.strip()}")
53
- # Return the answer stripped (no extra spaces/newlines)
54
- return answer.strip()
 
 
 
 
 
 
 
 
 
 
 
 
55
 
56
  # Put it all together
57
  def run_and_submit_all( profile: gr.OAuthProfile | None):
 
46
  )
47
 
48
  def __call__(self, question: str) -> str:
49
+ print(f"Agent received question (first 50 chars): {question[:50]}...")
50
+ print("Your token:", repr(os.getenv("HUGGINGFACEHUB_API_TOKEN"))) ##########
51
+ try:
52
+ # Example: replace this with your actual inference call
53
+ response = self.agent.run(question)
54
+ print("Agent response:", response)
55
+
56
+ except Exception as e:
57
+ import traceback
58
+ print("====== Exception occurred during inference ======")
59
+ traceback.print_exc() # This prints the full stack trace to your console/log
60
+ print("Exception message:", str(e))
61
+
62
+ # # Run the agent to get the answer
63
+ # answer = self.agent.run(question)
64
+ # print(f"Agent returning answer: {answer.strip()}")
65
+ # # Return the answer stripped (no extra spaces/newlines)
66
+ # return answer.strip()
67
 
68
  # Put it all together
69
  def run_and_submit_all( profile: gr.OAuthProfile | None):