Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -6,6 +6,14 @@ import pandas as pd
|
|
| 6 |
import time
|
| 7 |
from smolagents import CodeAgent, OpenAIServerModel, DuckDuckGoSearchTool, GoogleSearchTool, WikipediaSearchTool, VisitWebpageTool, PythonInterpreterTool
|
| 8 |
from smolagents.agents import PromptTemplates
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
|
| 10 |
GEMINI_API_KEY = os.environ.get("GEMINI_API_KEY")
|
| 11 |
|
|
@@ -24,9 +32,20 @@ DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
|
|
| 24 |
class BasicAgent:
|
| 25 |
def __init__(self):
|
| 26 |
self.agent = CodeAgent(
|
| 27 |
-
tools = [GoogleSearchTool(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28 |
model = model,
|
| 29 |
add_base_tools=True,
|
|
|
|
| 30 |
)
|
| 31 |
|
| 32 |
print("BasicAgent initialized.")
|
|
|
|
| 6 |
import time
|
| 7 |
from smolagents import CodeAgent, OpenAIServerModel, DuckDuckGoSearchTool, GoogleSearchTool, WikipediaSearchTool, VisitWebpageTool, PythonInterpreterTool
|
| 8 |
from smolagents.agents import PromptTemplates
|
| 9 |
+
from tool import (save_and_read_file,
|
| 10 |
+
download_file_from_url,
|
| 11 |
+
extract_text_from_image,
|
| 12 |
+
analyze_csv_file,
|
| 13 |
+
analyze_excel_file,
|
| 14 |
+
extract_video_id,
|
| 15 |
+
get_youtube_transcript)
|
| 16 |
+
|
| 17 |
|
| 18 |
GEMINI_API_KEY = os.environ.get("GEMINI_API_KEY")
|
| 19 |
|
|
|
|
| 32 |
class BasicAgent:
|
| 33 |
def __init__(self):
|
| 34 |
self.agent = CodeAgent(
|
| 35 |
+
tools = [GoogleSearchTool(),
|
| 36 |
+
WikipediaSearchTool(),
|
| 37 |
+
VisitWebpageTool(),
|
| 38 |
+
PythonInterpreterTool(),
|
| 39 |
+
save_and_read_file,
|
| 40 |
+
download_file_from_url,
|
| 41 |
+
extract_text_from_image,
|
| 42 |
+
analyze_csv_file,
|
| 43 |
+
analyze_excel_file,
|
| 44 |
+
extract_video_id,
|
| 45 |
+
get_youtube_transcript],
|
| 46 |
model = model,
|
| 47 |
add_base_tools=True,
|
| 48 |
+
additional_authorized_imports=["os","tempfile","requests", "urllib", "pytesseract", "PIL", "pandas", "uuid", "youtube_transcript_api"]
|
| 49 |
)
|
| 50 |
|
| 51 |
print("BasicAgent initialized.")
|