Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -28,13 +28,17 @@ class BasicAgent:
|
|
| 28 |
result = self.whisper_model.transcribe(audio_path)
|
| 29 |
return result["text"]
|
| 30 |
|
| 31 |
-
def
|
| 32 |
try:
|
| 33 |
with DDGS() as ddgs:
|
| 34 |
results = list(ddgs.text(question, max_results=1))
|
| 35 |
return results[0]["body"] if results else "No relevant search results found."
|
| 36 |
except Exception as e:
|
| 37 |
return f"Search error: {e}"
|
|
|
|
|
|
|
|
|
|
|
|
|
| 38 |
|
| 39 |
def __call__(self, question: str, video_path: str = None) -> str:
|
| 40 |
print(f"Agent received question (first 50 chars): {question[:50]}...")
|
|
|
|
| 28 |
result = self.whisper_model.transcribe(audio_path)
|
| 29 |
return result["text"]
|
| 30 |
|
| 31 |
+
def search(self, question: str) -> str:
|
| 32 |
try:
|
| 33 |
with DDGS() as ddgs:
|
| 34 |
results = list(ddgs.text(question, max_results=1))
|
| 35 |
return results[0]["body"] if results else "No relevant search results found."
|
| 36 |
except Exception as e:
|
| 37 |
return f"Search error: {e}"
|
| 38 |
+
|
| 39 |
+
def __call__(self, question: str) -> str:
|
| 40 |
+
# Use the search method to answer the question
|
| 41 |
+
return self.search(question)
|
| 42 |
|
| 43 |
def __call__(self, question: str, video_path: str = None) -> str:
|
| 44 |
print(f"Agent received question (first 50 chars): {question[:50]}...")
|