Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -31,23 +31,13 @@ class BasicAgent:
|
|
| 31 |
llm=self.llm,
|
| 32 |
)
|
| 33 |
def __call__(self, question: str) -> str:
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
if loop.is_running():
|
| 38 |
-
# Use nest_asyncio for notebooks / interactive environments
|
| 39 |
-
import nest_asyncio
|
| 40 |
-
nest_asyncio.apply()
|
| 41 |
-
fixed_answer = loop.run_until_complete(self.llamaindex_agent.run(question))
|
| 42 |
-
else:
|
| 43 |
-
fixed_answer = loop.run_until_complete(self.llamaindex_agent.run(question))
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
print(f"Agent received question (first 50 chars): {question[:50]}...")
|
| 47 |
#fixed_answer = "This is a default answer."
|
| 48 |
#fixed_answer = self.llamaindex_agent.run(question)
|
| 49 |
-
print(f"Agent returning fixed answer: {fixed_answer}")
|
| 50 |
-
return fixed_answer
|
| 51 |
|
| 52 |
def run_and_submit_all( profile: gr.OAuthProfile | None):
|
| 53 |
"""
|
|
|
|
| 31 |
llm=self.llm,
|
| 32 |
)
|
| 33 |
def __call__(self, question: str) -> str:
|
| 34 |
+
return asyncio.get_event_loop().run_until_complete(super().__call__(question))
|
| 35 |
+
|
| 36 |
+
#print(f"Agent received question (first 50 chars): {question[:50]}...")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 37 |
#fixed_answer = "This is a default answer."
|
| 38 |
#fixed_answer = self.llamaindex_agent.run(question)
|
| 39 |
+
#print(f"Agent returning fixed answer: {fixed_answer}")
|
| 40 |
+
#return fixed_answer
|
| 41 |
|
| 42 |
def run_and_submit_all( profile: gr.OAuthProfile | None):
|
| 43 |
"""
|