Spaces:
Build error
Build error
| from smolagents import LiteLLMModel, CodeAgent, DuckDuckGoSearchTool, VisitWebpageTool | |
| import os | |
| from smolagents import tool | |
| from pathlib import Path | |
| def audio_to_text(path: Path) -> str: | |
| """ | |
| This tool returns the transcription of an audio file. | |
| Args: | |
| path: file path of audio file to transcribe. | |
| """ | |
| import whisper | |
| whisper_model=whisper.load_model("turbo") | |
| transcription = whisper_model.transcribe(path) | |
| return transcription | |
| gemini_api_key = os.environ["GOOGLE_API_KEY"] | |
| model = LiteLLMModel(model_id = "gemini/gemini-2.0-flash", api_key=gemini_api_key) | |
| web_agent = CodeAgent(name="web_agent", description="Agent to search/browse the web", model=model, tools=[VisitWebpageTool(), DuckDuckGoSearchTool()], additional_authorized_imports=["beautifulsoup"]) | |
| agent = CodeAgent(model=model, tools=[audio_to_text], managed_agents=[web_agent], additional_authorized_imports=["pandas","PIL", "bs4"], planning_interval=5) |