Spaces:
Running on Zero
Running on Zero
Deploy OmniAssistant smolagent (Hugging Face Agents Course Unit 1)
Browse filesFiles changed (2)
- Gradio_UI.py-1
- app.py+36-14
284 unmodified lines285286287288289290291284 unmodified lines),resizable=True,scale=1,type="messages",)# If an upload folder is provided, enable the upload featureif self.file_upload_folder is not None:284 unmodified lines285286287288289290284 unmodified lines),resizable=True,scale=1,)# If an upload folder is provided, enable the upload featureif self.file_upload_folder is not None:
125 unmodified lines126127128129130131132133134135136137138139140141142143144145146147148149150151152125 unmodified lineswith open(prompts_file, "r") as stream:prompt_templates = yaml.safe_load(stream)# Aggregate tools listagent_tools = [final_answer,web_search,get_current_time_in_timezone,get_weather,search_wikipedia,]if image_generation_tool is not None:agent_tools.append(image_generation_tool)agent = CodeAgent(model=model,tools=agent_tools,max_steps=6,verbosity_level=1,planning_interval=None,name="OmniAssistant",description="A multi-functional assistant capable of web search, live weather, Wikipedia summaries, timezone calculations, and image generation.",prompt_templates=prompt_templates)if __name__ == "__main__":GradioUI(agent).launch()125 unmodified lines126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174125 unmodified lineswith open(prompts_file, "r") as stream:prompt_templates = yaml.safe_load(stream)# --- Specialist Agents (Unit 2: Hierarchical Multi-Agent System) ---# Specialist 1: Web & Wikipedia Researcherresearch_agent = CodeAgent(model=model,tools=[web_search, search_wikipedia],max_steps=4,verbosity_level=1,name="web_researcher",description="A specialist researcher that searches DuckDuckGo and queries Wikipedia to gather accurate facts and summaries.",prompt_templates=prompt_templates)# Specialist 2: Weather & Timezone Specialistlocal_info_agent = CodeAgent(model=model,tools=[get_current_time_in_timezone, get_weather],max_steps=4,verbosity_level=1,name="local_info_specialist",description="A specialist agent that fetches real-time live weather reports and calculates current time in timezones worldwide.",prompt_templates=prompt_templates)# Manager Agent: Coordinates specialists and synthesizes the final responsemanager_tools = [final_answer]if image_generation_tool is not None:manager_tools.append(image_generation_tool)manager_agent = CodeAgent(model=model,tools=manager_tools,managed_agents=[research_agent, local_info_agent],max_steps=8,verbosity_level=1,planning_interval=None,name="OmniAssistant_Manager",description="A senior manager agent that breaks down user tasks and delegates them to specialized team members (web researcher and local info specialist).",prompt_templates=prompt_templates)# Main agent interface for Gradioagent = manager_agentif __name__ == "__main__":GradioUI(agent).launch()
Gradio_UI.py-1
app.py+36-14