akhaliq HF Staff commited on
Commit
14fc3d6
Β·
1 Parent(s): 4507a25

update readme

Browse files
Files changed (1) hide show
  1. README.md +56 -292
README.md CHANGED
@@ -14,23 +14,21 @@ hf_oauth_scopes:
14
  # Note: 'openid' and 'profile' are always included by default and should not be listed here.
15
  ---
16
 
17
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
18
-
19
  # AnyCoder - AI Code Generator
20
 
21
- AnyCoder is an AI-powered code generator that helps you create applications by describing them in plain English. It supports multiple AI models and can generate HTML/CSS/JavaScript code for web applications.
22
 
23
  ## Features
24
 
25
- - **Multi-Model Support**: Choose from various AI models including DeepSeek, ERNIE-4.5-VL, MiniMax, and Qwen
26
- - **Image-to-Code**: Upload UI design images and get corresponding HTML/CSS code (ERNIE-4.5-VL model)
27
- - **Image Text Extraction**: Upload images and extract text using OCR for processing
28
- - **Website Redesign**: Enter a website URL to extract content and redesign it with modern, responsive layouts
29
- - **Live Preview**: See your generated code in action with the built-in sandbox
30
- - **Web Search Integration**: Enable real-time web search to get the latest information and best practices
31
- - **Chat History**: Keep track of your conversations and generated code
32
- - **Quick Examples**: Pre-built examples to get you started quickly
33
- - **πŸš€ One-Click Deployment**: Deploy your generated applications directly to Hugging Face Spaces
34
 
35
  ## Installation
36
 
@@ -39,12 +37,10 @@ AnyCoder is an AI-powered code generator that helps you create applications by d
39
  git clone <repository-url>
40
  cd anycoder
41
  ```
42
-
43
  2. Install dependencies:
44
  ```bash
45
  pip install -r requirements.txt
46
  ```
47
-
48
  3. Set up environment variables:
49
  ```bash
50
  export HF_TOKEN="your_huggingface_token"
@@ -57,310 +53,78 @@ export TAVILY_API_KEY="your_tavily_api_key" # Optional, for web search feature
57
  ```bash
58
  python app.py
59
  ```
60
-
61
  2. Open your browser and navigate to the provided URL
 
 
 
 
 
 
 
 
 
 
62
 
63
- 3. Describe your application in the text input field
64
-
65
- 4. Optionally:
66
- - Upload a UI design image (for ERNIE-4.5-VL model)
67
- - Enable web search to get the latest information
68
- - Choose a different AI model
69
-
70
- 5. Click "Generate" to create your code
71
-
72
- 6. View the generated code in the Code Editor tab or see it in action in the Live Preview tab
73
-
74
- 7. **Deploy to Space**: Enter a title and click "πŸš€ Deploy to Space" to publish your application
75
-
76
- ## πŸš€ Deployment Feature
77
-
78
- AnyCoder now includes one-click deployment to Hugging Face Spaces! This feature allows you to:
79
-
80
- ### How to Deploy
81
-
82
- 1. **Login**: Click the "Sign in with Hugging Face" button in the sidebar
83
- 2. **Authorize Permissions**: When the authorization page appears, make sure to grant ALL the requested permissions:
84
- - βœ… **read-repos** - Read access to repositories
85
- - βœ… **write-repos** - Write access to create repositories
86
- - βœ… **manage-repos** - Manage repository settings
87
- 3. **Complete Authorization**: Click "Authorize" to complete the login
88
- 4. **Generate Code**: Generate some HTML code using the AI
89
- 5. **Enter Title**: In the sidebar, enter a title for your space (e.g., "My Todo App")
90
- 6. **Deploy**: Click the "πŸš€ Deploy to Space" button
91
- 7. **Share**: Get a shareable URL for your deployed application
92
-
93
- **Important**: You must grant ALL three permissions during the OAuth authorization process. If you only grant partial permissions, deployment will fail.
94
-
95
- **Note**: You need to be logged in with your Hugging Face account to deploy. This ensures that:
96
- - Deployments are created under your own account namespace
97
- - You can manage and update your spaces from your Hugging Face dashboard
98
- - Each deployment gets a unique URL under your username
99
-
100
- **Technical Note**: The deployment uses your personal OAuth token to create spaces under your account, ensuring full security and ownership of your deployed applications.
101
-
102
- ### Troubleshooting Deployment Issues
103
-
104
- If you encounter permission errors during deployment:
105
-
106
- 1. **Check Permissions**: Make sure you granted all three required permissions during login
107
- 2. **Logout and Login Again**: Click logout and sign in again, ensuring all permissions are granted
108
- 3. **Account Status**: Verify your Hugging Face account allows repository creation
109
- 4. **Network Issues**: Check your internet connection and try again
110
- 5. **Contact Support**: If issues persist, contact Hugging Face support
111
-
112
- ### What Gets Deployed
113
-
114
- - **Complete HTML Application**: Your generated code wrapped in a professional template
115
- - **Responsive Design**: Mobile-friendly layout with modern styling
116
- - **Project Documentation**: README with project details and prompts used
117
- - **Live URL**: Publicly accessible URL that anyone can visit
118
-
119
- ### Deployment Benefits
120
-
121
- - **Instant Publishing**: No need to set up hosting or domains
122
- - **Shareable**: Get a public URL to share with others
123
- - **Professional**: Clean, branded presentation of your work
124
- - **Version Control**: Each deployment creates a new space with timestamp
125
- - **Free Hosting**: Hosted on Hugging Face's infrastructure
126
 
127
- ### Example Deployment
 
 
 
 
 
 
 
128
 
129
- ```
130
- Title: "My Weather Dashboard"
131
- Generated Code: <div>Weather app HTML...</div>
132
- Result: https://huggingface.co/spaces/my-weather-dashboard-1234567890
133
- ```
134
 
135
- The deployed space will include:
136
- - Your application with professional styling
137
- - A header with your title and AnyCoder branding
138
- - A footer with attribution
139
- - A README documenting the project
140
 
141
  ## Web Search Feature
142
 
143
- The web search feature uses Tavily to provide real-time information when generating code. To enable this feature:
144
-
145
- 1. Get a free Tavily API key from [Tavily Platform](https://tavily.com/)
146
- 2. Set the `TAVILY_API_KEY` environment variable
147
- 3. Toggle the "πŸ” Enable Web Search" checkbox in the sidebar
148
-
149
- When enabled, the AI will search the web for the latest information, best practices, and technologies related to your request.
150
-
151
- ## Image Text Extraction
152
-
153
- The application supports extracting text from images using OCR (Optical Character Recognition). This feature allows you to:
154
-
155
- 1. Upload image files (JPG, PNG, BMP, TIFF, GIF, WebP) through the file input
156
- 2. Automatically extract text from the images using Tesseract OCR
157
- 3. Include the extracted text in your prompts for code generation
158
-
159
- ### Setting up OCR
160
-
161
- To use the image text extraction feature, you need to install Tesseract OCR on your system. See `install_tesseract.md` for detailed installation instructions.
162
-
163
- **Example usage:**
164
- - Upload an image containing text (like a screenshot, document, or handwritten notes)
165
- - The application will extract the text and include it in your prompt
166
- - You can then ask the AI to process, summarize, or work with the extracted text
167
-
168
- ## Website Redesign Feature
169
-
170
- The website redesign feature allows you to extract content from existing websites and generate modern, responsive redesigns. This feature:
171
 
172
- 1. **Extracts Website Content**: Automatically scrapes the target website to extract:
173
- - Page title and meta description
174
- - Navigation menu structure
175
- - Main content sections
176
- - Images and their descriptions
177
- - Overall page structure and purpose
178
 
179
- 2. **Generates Modern Redesigns**: Creates improved versions with:
180
- - Modern, responsive layouts
181
- - Enhanced user experience
182
- - Better accessibility
183
- - Mobile-first design principles
184
- - Current design trends and best practices
185
 
186
- ### How to Use Website Redesign
187
 
188
- 1. **Enter a Website URL**: In the "🌐 Website URL (for redesign)" field, enter the URL of the website you want to redesign
189
- - Example: `https://example.com`
190
- - The URL can be with or without `https://`
191
 
192
- 2. **Add Custom Requirements**: Optionally describe specific improvements you want:
193
- - "Make it more modern and minimalist"
194
- - "Add a dark mode toggle"
195
- - "Improve the mobile layout"
196
- - "Use a different color scheme"
197
 
198
- 3. **Enable Web Search**: Toggle the web search feature to get the latest design trends and best practices
 
199
 
200
- 4. **Generate**: Click "Generate" to create your redesigned website
201
 
202
- ### Example Usage
203
-
204
- ```
205
- URL: https://example.com
206
- Description: Redesign this website with a modern, minimalist approach. Use a clean typography and improve the mobile experience.
207
- ```
208
-
209
- The AI will analyze the original website content and create a completely redesigned version that maintains the core functionality while providing a better user experience.
210
-
211
- ### Supported Websites
212
-
213
- The feature works with most public websites, including:
214
- - Business websites
215
- - Portfolio sites
216
- - Blog platforms
217
- - E-commerce sites
218
- - Landing pages
219
- - Documentation sites
220
-
221
- **Note**: Some websites may block automated access or require JavaScript to load content. In such cases, the extraction may be limited.
222
-
223
- ## Available Models
224
-
225
- - **DeepSeek V3**: Advanced code generation model
226
- - **DeepSeek R1**: Specialized for code generation tasks
227
- - **ERNIE-4.5-VL**: Multimodal model with image support
228
- - **MiniMax M1**: General-purpose AI model
229
- - **Qwen3-235B-A22B**: Large language model for code generation
230
 
231
  ## Environment Variables
232
 
233
  - `HF_TOKEN`: Your Hugging Face API token (required)
234
  - `TAVILY_API_KEY`: Your Tavily API key (optional, for web search)
235
 
236
- ## License
237
-
238
- [Add your license information here]
239
-
240
  ## Project Structure
241
 
242
  ```
243
  anycoder/
244
- β”œβ”€β”€ app.py # Main application (everything included)
245
- β”œβ”€β”€ app.css # Basic styling
246
- β”œβ”€β”€ pyproject.toml # Dependencies
247
- └── README.md # This file
248
  ```
249
 
250
- ## Setup
251
-
252
- 1. Set your Hugging Face API token:
253
- ```bash
254
- export HF_TOKEN="your_huggingface_token"
255
- ```
256
-
257
- 2. Install dependencies:
258
- ```bash
259
- uv sync
260
- ```
261
-
262
- 3. Run the application:
263
- ```bash
264
- uv run python app.py
265
- ```
266
-
267
- ## Usage
268
-
269
- 1. **Sign in with your Hugging Face account** using the login button at the top left.
270
- 2. Enter your application requirements in the text area
271
- 3. Click "send" to generate code
272
- 4. View the generated code in the code drawer
273
- 5. See the live preview in the sandbox area
274
- 6. Use example cards for quick prompts
275
-
276
- ## Code Example
277
-
278
- ```python
279
- import os
280
- from huggingface_hub import InferenceClient
281
-
282
- client = InferenceClient(
283
- provider="novita",
284
- api_key=os.environ["HF_TOKEN"],
285
- bill_to="huggingface"
286
- )
287
-
288
- completion = client.chat.completions.create(
289
- model="deepseek-ai/DeepSeek-V3-0324",
290
- messages=[
291
- {
292
- "role": "user",
293
- "content": "Create a simple todo app"
294
- }
295
- ],
296
- )
297
- ```
298
-
299
- ## Architecture
300
-
301
- The application uses:
302
- - **Gradio**: For the web interface
303
- - **Hugging Face Hub**: For model inference
304
- - **ModelScope Studio**: For UI components
305
- - **OAuth Login**: Requires users to sign in with Hugging Face for code generation
306
- - **Streaming**: For real-time code generation
307
-
308
- # Hugging Face Coder
309
-
310
- A Gradio-based application that uses Hugging Face models to generate code based on user requirements. The app supports both text-only and multimodal (text + image) code generation.
311
-
312
- ## Features
313
-
314
- - **Multiple Model Support**: DeepSeek V3, DeepSeek R1, and ERNIE-4.5-VL
315
- - **Multimodal Input**: Upload images to help describe your requirements
316
- - **Real-time Code Generation**: Stream responses from the models
317
- - **Live Preview**: See your generated code in action with the built-in sandbox
318
- - **History Management**: Keep track of your previous generations
319
- - **Example Templates**: Quick-start with predefined application templates
320
-
321
- ## Setup
322
-
323
- 1. Install dependencies:
324
- ```bash
325
- pip install -r requirements.txt
326
- ```
327
-
328
- 2. Set your Hugging Face API token as an environment variable:
329
- ```bash
330
- export HF_TOKEN="your_huggingface_token"
331
- ```
332
-
333
- 3. Run the application:
334
- ```bash
335
- python app.py
336
- ```
337
-
338
- ## Usage
339
-
340
- 1. **Text-only Generation**: Simply type your requirements in the text area
341
- 2. **Multimodal Generation**: Upload an image and describe what you want to create
342
- 3. **Model Selection**: Switch between different models using the model selector
343
- 4. **Examples**: Use the provided example templates to get started quickly
344
-
345
- ## Supported Models
346
-
347
- - **DeepSeek V3**: General code generation
348
- - **DeepSeek R1**: Advanced code generation
349
- - **ERNIE-4.5-VL**: Multimodal code generation with image understanding
350
-
351
- ## Environment Variables
352
-
353
- - `HF_TOKEN`: Your Hugging Face API token (required)
354
-
355
- ## Examples
356
 
357
- - Todo App
358
- - Calculator
359
- - Weather Dashboard
360
- - Chat Interface
361
- - E-commerce Product Card
362
- - Login Form
363
- - Dashboard Layout
364
- - Data Table
365
- - Image Gallery
366
- - UI from Image (multimodal)
 
14
  # Note: 'openid' and 'profile' are always included by default and should not be listed here.
15
  ---
16
 
 
 
17
  # AnyCoder - AI Code Generator
18
 
19
+ 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 pure Gradio theming for a minimal, modern experience.
20
 
21
  ## Features
22
 
23
+ - **Multi-Model Support**: Choose from Moonshot Kimi-K2, DeepSeek V3, DeepSeek R1, ERNIE-4.5-VL, MiniMax M1, Qwen3-235B-A22B, SmolLM3-3B, and GLM-4.1V-9B-Thinking
24
+ - **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
25
+ - **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
26
+ - **Code Generation**: Generate code in HTML, Python, JS, and more. Special support for transformers.js apps (outputs index.html, index.js, style.css)
27
+ - **Live Preview**: Instantly preview generated HTML in a sandboxed iframe
28
+ - **Modify Existing Code**: Use search/replace block format to update generated HTML
29
+ - **One-Click Deployment**: Deploy your app to Hugging Face Spaces (Gradio, Streamlit, Static HTML, or Transformers.js) with OAuth login
30
+ - **History & Examples**: Chat-like history of all interactions and quick example prompts for fast prototyping
31
+ - **Minimal, Modern UI**: Built with Gradio 5.x, using only built-in theming and styling (no custom CSS)
32
 
33
  ## Installation
34
 
 
37
  git clone <repository-url>
38
  cd anycoder
39
  ```
 
40
  2. Install dependencies:
41
  ```bash
42
  pip install -r requirements.txt
43
  ```
 
44
  3. Set up environment variables:
45
  ```bash
46
  export HF_TOKEN="your_huggingface_token"
 
53
  ```bash
54
  python app.py
55
  ```
 
56
  2. Open your browser and navigate to the provided URL
57
+ 3. Describe your application in the text input field, or:
58
+ - Upload a UI design image (for ERNIE-4.5-VL or GLM-4.1V-9B-Thinking)
59
+ - Upload a reference file (PDF, TXT, MD, CSV, DOCX, or image)
60
+ - Enter a website URL for redesign (the app will extract and analyze the HTML and content)
61
+ - Enable web search for up-to-date information
62
+ - Choose a different AI model or code language
63
+ 4. Click "Generate" to create your code
64
+ 5. View the generated code in the Code tab or see it in action in the Preview tab
65
+ 6. Use the History tab to review previous generations
66
+ 7. **Deploy to Space**: Enter a title, select SDK, and click "πŸš€ Deploy App" to publish your application (OAuth login required)
67
 
68
+ ## Supported Models
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
69
 
70
+ - Moonshot Kimi-K2
71
+ - DeepSeek V3
72
+ - DeepSeek R1
73
+ - ERNIE-4.5-VL (multimodal)
74
+ - MiniMax M1
75
+ - Qwen3-235B-A22B
76
+ - SmolLM3-3B
77
+ - GLM-4.1V-9B-Thinking (multimodal)
78
 
79
+ ## Input Options
 
 
 
 
80
 
81
+ - **Text Prompt**: Describe your app or code requirements
82
+ - **Image Upload**: For multimodal models, upload a UI design image to generate code from visuals
83
+ - **File Upload**: Provide a reference file (PDF, TXT, MD, CSV, DOCX, or image) for code generation or text extraction (OCR for images)
84
+ - **Website URL**: Enter a URL to extract and redesign the website (HTML and content are analyzed and modernized)
 
85
 
86
  ## Web Search Feature
87
 
88
+ - Enable the "Web search" toggle to use Tavily for real-time information (requires TAVILY_API_KEY)
89
+ - Uses advanced search depth for best results
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
90
 
91
+ ## Code Generation & Modification
 
 
 
 
 
92
 
93
+ - Generates code in HTML, Python, JS, and more (selectable via dropdown)
94
+ - Special support for transformers.js apps (outputs index.html, index.js, style.css)
95
+ - For HTML, provides a live preview in a sandboxed iframe
96
+ - For modification requests, uses a search/replace block format to update existing HTML
 
 
97
 
98
+ ## Deployment
99
 
100
+ - Deploy generated apps to Hugging Face Spaces directly from the UI
101
+ - Supported SDKs: Gradio (Python), Streamlit (Python), Static (HTML), Transformers.js
102
+ - OAuth login with Hugging Face is required for deployment to user-owned Spaces
103
 
104
+ ## History & Examples
 
 
 
 
105
 
106
+ - Maintains a chat-like history of user/assistant interactions
107
+ - Quick example prompts are available in the sidebar for fast prototyping
108
 
109
+ ## UI/UX
110
 
111
+ - Built with Gradio 5.x, using only Gradio's built-in theming and styling (no custom CSS)
112
+ - Minimal, uncluttered sidebar and interface
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
113
 
114
  ## Environment Variables
115
 
116
  - `HF_TOKEN`: Your Hugging Face API token (required)
117
  - `TAVILY_API_KEY`: Your Tavily API key (optional, for web search)
118
 
 
 
 
 
119
  ## Project Structure
120
 
121
  ```
122
  anycoder/
123
+ β”œβ”€β”€ app.py # Main application (all logic and UI)
124
+ β”œβ”€β”€ requirements.txt
125
+ β”œβ”€β”€ README.md # This file
 
126
  ```
127
 
128
+ ## License
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
129
 
130
+ [Add your license information here]