Spaces:
Sleeping
Sleeping
| import yaml | |
| import os | |
| from smolagents import GradioUI, CodeAgent, OpenAIServerModel | |
| # Get current directory path | |
| CURRENT_DIR = os.path.dirname(os.path.abspath(__file__)) | |
| from tools.web_search import DuckDuckGoSearchTool as WebSearch | |
| from tools.visit_webpage import VisitWebpageTool as VisitWebpage | |
| from tools.estimate_renovation_cost import SimpleTool as EstimateRenovationCost | |
| from tools.material_calculator import SimpleTool as MaterialCalculator | |
| from tools.renovation_timeline_estimator import TimelineEstimatorTool as RenovationTimelineEstimator | |
| from tools.contractor_matcher import ContractorMatchingTool as ContractorMatcher | |
| from tools.final_answer import FinalAnswerTool as FinalAnswer | |
| model = OpenAIServerModel( | |
| model_id='gpt-4o-mini', | |
| ) | |
| web_search = WebSearch() | |
| visit_webpage = VisitWebpage() | |
| estimate_renovation_cost = EstimateRenovationCost() | |
| material_calculator = MaterialCalculator() | |
| renovation_timeline_estimator = RenovationTimelineEstimator() | |
| contractor_matcher = ContractorMatcher() | |
| final_answer = FinalAnswer() | |
| with open(os.path.join(CURRENT_DIR, "prompts.yaml"), 'r') as stream: | |
| prompt_templates = yaml.safe_load(stream) | |
| agent = CodeAgent( | |
| model=model, | |
| tools=[web_search, visit_webpage, estimate_renovation_cost, material_calculator, renovation_timeline_estimator, contractor_matcher], | |
| managed_agents=[], | |
| max_steps=12, | |
| verbosity_level=2, | |
| grammar=None, | |
| planning_interval=None, | |
| name='Renovation_Planner_AI', | |
| description=None, | |
| executor_type='local', | |
| executor_kwargs={}, | |
| max_print_outputs_length=None, | |
| prompt_templates=prompt_templates | |
| ) | |
| if __name__ == "__main__": | |
| GradioUI(agent).launch() | |