Spaces:
Running
Running
Download app.py from maubilli/BestLocalModelAgent: direct link, hf CLI and curl.
- Browser
- Download file 1.42 kB
-
https://huggingface.co/spaces/maubilli/BestLocalModelAgent/resolve/main/app.py
- Command line
-
hf download hf://spaces/maubilli/BestLocalModelAgent/app.py
-
curl -L -o app.py https://huggingface.co/spaces/maubilli/BestLocalModelAgent/resolve/main/app.py
1.42 kB
| import yaml | |
| import os | |
| from smolagents import GradioUI, CodeAgent, OpenAIModel | |
| # Get current directory path | |
| CURRENT_DIR = os.path.dirname(os.path.abspath(__file__)) | |
| from tools.get_system_hardware_specs import SimpleTool as GetSystemHardwareSpecs | |
| from tools.fetch_huggingface_models_tool import SimpleTool as FetchHuggingfaceModelsTool | |
| from tools.generate_recommendation_report import SimpleTool as GenerateRecommendationReport | |
| from tools.web_search import DuckDuckGoSearchTool as WebSearch | |
| from tools.final_answer import FinalAnswerTool as FinalAnswer | |
| model = OpenAIModel( | |
| model_id='qwen2.5-coder:7b', | |
| ) | |
| get_system_hardware_specs = GetSystemHardwareSpecs() | |
| fetch_huggingface_models_tool = FetchHuggingfaceModelsTool() | |
| generate_recommendation_report = GenerateRecommendationReport() | |
| web_search = WebSearch() | |
| 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=[get_system_hardware_specs, fetch_huggingface_models_tool, generate_recommendation_report, web_search], | |
| managed_agents=[], | |
| max_steps=20, | |
| verbosity_level=1, | |
| planning_interval=None, | |
| name=None, | |
| description=None, | |
| executor_type='local', | |
| executor_kwargs={}, | |
| max_print_outputs_length=None, | |
| prompt_templates=prompt_templates | |
| ) | |
| if __name__ == "__main__": | |
| GradioUI(agent).launch() | |