Spaces:
Build error
Build error
Download utils.py from yo-mf-mama/anycoder-29f1e621: direct link, hf CLI and curl.
- Browser
- Download file 1.12 kB
-
https://huggingface.co/spaces/yo-mf-mama/anycoder-29f1e621/resolve/main/utils.py
- Command line
-
hf download hf://spaces/yo-mf-mama/anycoder-29f1e621/utils.py
-
curl -L -o utils.py https://huggingface.co/spaces/yo-mf-mama/anycoder-29f1e621/resolve/main/utils.py
1.12 kB
| import os | |
| import json | |
| import base64 | |
| import zipfile | |
| import tempfile | |
| from pathlib import Path | |
| from datetime import datetime | |
| from typing import Dict, List, Optional | |
| import re | |
| def create_agent_template( | |
| agent_name: str, | |
| agent_type: str, | |
| generated_code: str, | |
| programming_language: str = "Python" | |
| ) -> Dict[str, str]: | |
| """Create a complete agent template with all necessary files.""" | |
| files = {} | |
| # Main agent file | |
| if programming_language == "Python": | |
| files[f"{agent_name}.py"] = generated_code | |
| # Configuration file | |
| files["config.json"] = json.dumps({ | |
| "name": agent_name, | |
| "type": agent_type, | |
| "language": programming_language, | |
| "created": datetime.now().isoformat(), | |
| "version": "1.0.0" | |
| }, indent=2) | |
| # Requirements file | |
| files["requirements.txt"] = "daggr>=0.5.4\ngradio>=6.0.2\nstreamlit>=1.28.0" | |
| # README | |
| files["README.md"] = f"""# {agent_name} | |
| ## Description | |
| {agent_type} agent built with natural language. | |
| ## Usage | |
| Run the agent with: |