Spaces:
Sleeping
Sleeping
Update app.py
Browse files
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 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
|
| 57 |
-
except Exception as e:
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
#
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
#
|
| 67 |
-
|
| 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):
|