File size: 1,741 Bytes
ec1b2a6
 
 
 
 
 
 
 
 
 
 
877b38e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
ec1b2a6
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
---
title: CodeGen
emoji: 🤖
colorFrom: indigo
colorTo: blue
sdk: docker
python_version: 3.10
app_file: main.py
app_port: 8000
pinned: false
---
# CodeGen

A FastAPI service that generates single-page web applications using AI. This service takes natural language descriptions and automatically generates web applications, creates GitHub repositories, and handles deployments.

## Features

-  AI-powered web application generation
-  Automatic GitHub repository creation and management
-  GitHub Pages hosting setup
-  Built-in evaluation submission handling
-  Support for multi-round updates
-  Secure API with secret key authentication

## Requirements

- Python 3.10 or higher
- GitHub account with API access
- AI API key (OpenRouter)

## Setup

1. Clone the repository:
   ```bash
   git clone <repo url or ssh>
   cd codegen
   ```

2. Create a virtual environment:
   ```bash
   python -m venv .venv
   source .venv/bin/activate  # On Windows: .venv\Scripts\activate
   ```

3. Create a `.env` file with your credentials:
   ```
   SECRET_KEY=your_secret
   GITHUB_TOKEN=your_github_token
   AI_API_KEY=your_ai_key
   ```

4. Install dependencies:
   ```bash
   uv sync
   ```

5. Install development dependencies:
   ```bash
   uv sync -G dev
   ```

## Usage

Start the development server:
```bash
uvicorn main:app --reload
```

The server will listen on `http://localhost:8000` for incoming task requests.

### API Endpoints

- `GET /`: Health check endpoint
- `POST /task1`: Main endpoint for task processing
  - Requires authentication via `secret` field
  - Handles both initial creation (round 1) and updates (round > 1)
  - Returns repository and GitHub Pages URLs

## License

MIT License - See LICENSE file for details