lopera47 commited on
Commit
eda4c08
·
verified ·
1 Parent(s): 75f5e81

Update app.py

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