Spaces:
Runtime error
Runtime error
fix
Browse filesFiles changed (5)
- Dockerfile-2
- README.md-8
- README_GRADIO.mdDeleted-145
- app.pyDeleted-31
- backend_search_replace.py+1-1
51 unmodified lines525354555657582 unmodified lines6162636465666751 unmodified linespip install --no-cache-dir -r requirements.txt# Copy application codeCOPY --chown=user:user anycoder_app/ ./anycoder_app/COPY --chown=user:user backend_api.py .COPY --chown=user:user backend_models.py .COPY --chown=user:user backend_docs_manager.py .2 unmodified linesCOPY --chown=user:user backend_deploy.py .COPY --chown=user:user backend_search_replace.py .COPY --chown=user:user project_importer.py .COPY --chown=user:user app.py .# Copy built frontend from builder stageCOPY --chown=user:user --from=frontend-builder /build/.next ./frontend/.next51 unmodified lines5253545556572 unmodified lines60616263646551 unmodified linespip install --no-cache-dir -r requirements.txt# Copy application codeCOPY --chown=user:user backend_api.py .COPY --chown=user:user backend_models.py .COPY --chown=user:user backend_docs_manager.py .2 unmodified linesCOPY --chown=user:user backend_deploy.py .COPY --chown=user:user backend_search_replace.py .COPY --chown=user:user project_importer.py .# Copy built frontend from builder stageCOPY --chown=user:user --from=frontend-builder /build/.next ./frontend/.next
13 unmodified lines141516171819202120 unmodified lines42434445464748495051525313 unmodified lines- write-discussions---> **Note:** This is the Docker Space configuration for the React frontend version.> For the original Gradio app, see `README_GRADIO.md`.# AnyCoder - AI Code Generator with React Frontend20 unmodified linesβ β βββ lib/ # API client, auth utilitiesβ β βββ types/ # TypeScript typesβ βββ package.jsonβββ anycoder_app/ # Original Gradio app modulesβ βββ agent.pyβ βββ config.pyβ βββ deploy.pyβ βββ ...βββ app.py # Original Gradio interfaceβββ requirements.txt # Python dependenciesβββ Dockerfile # Docker Space configurationβββ start_fullstack.sh # Local development script13 unmodified lines14151617181920 unmodified lines40414243444513 unmodified lines- write-discussions---# AnyCoder - AI Code Generator with React Frontend20 unmodified linesβ β βββ lib/ # API client, auth utilitiesβ β βββ types/ # TypeScript typesβ βββ package.jsonβββ requirements.txt # Python dependenciesβββ Dockerfile # Docker Space configurationβββ start_fullstack.sh # Local development script
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145---title: Anycoderemoji: π₯colorFrom: indigocolorTo: indigosdk: gradiosdk_version: 5.49.1app_file: app.pypinned: falsedisable_embedding: truehf_oauth: truehf_oauth_scopes:- manage-repos---
# AnyCoder - AI Code Generator
> **π± New:** A React/TypeScript frontend version is now the default! This file is the backup Gradio version. For the Docker Space with modern React UI, see `README.md`.
AnyCoder is an AI-powered code generator that helps you create applications by describing them in plain English. It supports multiple AI models, multimodal input, website redesign, and one-click deployment to Hugging Face Spaces. The UI is built with Gradio theming for a minimal, modern experience.
## Features
- **Multi-Model Support**: Choose from Moonshot Kimi-K2, Kimi K2 Turbo (Preview), Kimi K2 Thinking, DeepSeek V3, DeepSeek R1, ERNIE-4.5-VL, MiniMax M2, Qwen3-235B-A22B, Qwen3-30B-A3B-Instruct-2507, Qwen3-30B-A3B-Thinking-2507, SmolLM3-3B, GLM-4.1V-9B-Thinking, Gemini 2.5 Flash and Gemini 2.5 Pro (OpenAI-compatible) - Claude-Opus-4.1 (via Poe)- **Flexible Input**: Describe your app in text, upload a UI design image (for multimodal models), provide a reference file (PDF, TXT, MD, CSV, DOCX, or image), or enter a website URL for redesign- **Web Search Integration**: Enable real-time web search (Tavily, with advanced search depth) to enhance code generation with up-to-date information and best practices- **Code Generation**: Generate code in HTML, Python, JS, and more. Special support for transformers.js apps (outputs index.html, index.js, style.css)- **Live Preview**: Instantly preview generated HTML in a sandboxed iframe- **Modify Existing Code**: Use search/replace block format to update generated HTML- **One-Click Deployment**: Deploy your app to Hugging Face Spaces (Gradio, Streamlit, Static HTML, or Transformers.js) with OAuth login- **History & Examples**: Chat-like history of all interactions and quick example prompts for fast prototyping- **Minimal, Modern UI**: Built with Gradio 5.x, using only built-in theming and styling (no custom CSS)
## Installation
1. Clone the repository:```bashgit clone <repository-url>cd anycoder```2. Install dependencies:```bashpip install -r requirements.txt```3. Set up environment variables:```bashexport HF_TOKEN="your_huggingface_token"export DASHSCOPE_API_KEY="your_dashscope_api_key" # Required for Qwen3-30B models via DashScopeexport POE_API_KEY="your_poe_api_key" # Required for GPT-5, Grok-4, and Grok-Code-Fast-1 via Poeexport GEMINI_API_KEY="your_gemini_api_key" # Required for Gemini modelsexport MOONSHOT_API_KEY="your_moonshot_api_key" # Required for Kimi modelsexport MINIMAX_API_KEY="your_minimax_api_key" # Required for MiniMax M2 model```
## Usage
1. Run the application:```bashpython app.py```2. Open your browser and navigate to the provided URL3. Describe your application in the text input field, or: - Upload a UI design image (for multimodal models) - Upload a reference file (PDF, TXT, MD, CSV, DOCX, or image) - Enter a website URL for redesign (the app will extract and analyze the HTML and content) - Enable web search for up-to-date information - Choose a different AI model or code language4. Click "Generate" to create your code5. View the generated code in the Code tab or see it in action in the Preview tab6. Use the History tab to review previous generations7. **Deploy to Space**: Enter a title and click "π Deploy App" to publish your application (OAuth login required) - the SDK is automatically matched to your selected code language
## Supported Models
- Moonshot Kimi-K2- Kimi K2 Turbo (Preview)- Kimi K2 Thinking- DeepSeek V3- DeepSeek V3.1- DeepSeek V3.1 Terminus- DeepSeek V3.2-Exp- DeepSeek R1- MiniMax M2- Qwen3-235B-A22B- Qwen3-4B-Instruct-2507- Qwen3-4B-Thinking-2507- Qwen3-30B-A3B-Instruct-2507 (via DashScope)- Qwen3-30B-A3B-Thinking-2507 (via DashScope)- GPT-5 (via Poe)- Grok-4 (via Poe) - Claude-Opus-4.1 (via Poe) - Gemini 2.5 Flash (OpenAI-compatible) - Gemini 2.5 Pro (OpenAI-compatible)
## Input Options
- **Text Prompt**: Describe your app or code requirements- **Image Upload**: For multimodal models, upload a UI design image to generate code from visuals- **File Upload**: Provide a reference file (PDF, TXT, MD, CSV, DOCX, or image) for code generation or text extraction (OCR for images)- **Website URL**: Enter a URL to extract and redesign the website (HTML and content are analyzed and modernized)
## Code Generation & Modification
- Generates code in HTML, Python, JS, and more (selectable via dropdown)- Special support for transformers.js apps (outputs index.html, index.js, style.css)- Svelte apps- For HTML, provides a live preview in a sandboxed iframe- For modification requests, uses a search/replace block format to update existing HTML
## Deployment
- Deploy generated apps to Hugging Face Spaces directly from the UI- Supported SDKs: Gradio (Python), Streamlit (Python), Static (HTML), Transformers.js- OAuth login with Hugging Face is required for deployment to user-owned Spaces
## History & Examples
- Maintains a chat-like history of user/assistant interactions- Quick example prompts are available in the sidebar for fast prototyping
## UI/UX
- Built with Gradio 5.x, using only Gradio's built-in theming and styling (no custom CSS)- Minimal, uncluttered sidebar and interface
## Environment Variables
- `HF_TOKEN`: Your Hugging Face API token (required) - `GEMINI_API_KEY`: Your Google Gemini API key (required to use Gemini models)- `MOONSHOT_API_KEY`: Your Moonshot AI API key (required to use Kimi models)- `MINIMAX_API_KEY`: Your MiniMax API key (required to use MiniMax M2 model)
## Project Structure
```anycoder/βββ app.py # Main application (all logic and UI)βββ requirements.txtβββ README.md # This file```
## License
[Add your license information here]12345678910111213141516171819202122232425262728293031"""AnyCoder - AI Code GeneratorMain application entry point - now with modular architecture!"""
# Import initialization functions from modulesfrom anycoder_app.docs_manager import ( initialize_gradio_docs, initialize_comfyui_docs, initialize_fastrtc_docs)from anycoder_app.ui import demo
if __name__ == "__main__": # Initialize documentation systems print("Initializing Gradio documentation...") initialize_gradio_docs() print("Initializing ComfyUI documentation...") initialize_comfyui_docs() print("Initializing FastRTC documentation...") initialize_fastrtc_docs() # Launch the application print("Launching AnyCoder application...") demo.queue(api_open=False, default_concurrency_limit=20).launch( show_api=False, ssr_mode=True, mcp_server=False )123456"""Search/Replace utilities for applying targeted code changes.Extracted from anycoder_app/parsers.py for use in backend."""# Search/Replace block markers123456"""Search/Replace utilities for applying targeted code changes.Search/Replace utilities for applying targeted code changes."""# Search/Replace block markers
Dockerfile-2
README.md-8
README_GRADIO.mdDeleted-145
app.pyDeleted-31
backend_search_replace.py+1-1