AIVAHr-project commited on
Commit
a3cd300
·
verified ·
1 Parent(s): 5ffc57b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -6
app.py CHANGED
@@ -85,12 +85,12 @@ class BasicAgent:
85
  additional_authorized_imports=["requests", "bs4", "json"]
86
  )
87
 
88
- def run(self, input_text):
89
- # Explicitly call run() method of agent instead of invoking the agent directly
90
- if hasattr(self.agent, 'run'):
91
- return self.agent.run(input_text) # Call the `run` method of CodeAgent
92
- else:
93
- raise AttributeError("The agent does not have a 'run' method.")
94
 
95
  def run_and_submit_all( profile: gr.OAuthProfile | None):
96
  """
 
85
  additional_authorized_imports=["requests", "bs4", "json"]
86
  )
87
 
88
+ def __call__(self, question: str) -> str:
89
+ try:
90
+ response = self.agent.run(question)
91
+ return response
92
+ except Exception as e:
93
+ return f"An error occurred: {e}"
94
 
95
  def run_and_submit_all( profile: gr.OAuthProfile | None):
96
  """