File size: 2,087 Bytes
e98d661
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
# πŸš€ Hugging Face Deployment Guide

## Quick Deploy to Hugging Face Spaces

### 1. Create New Space
- Go to [Hugging Face Spaces](https://huggingface.co/spaces)
- Click "Create new Space"
- Choose SDK: **Gradio**
- Set visibility: **Public**

### 2. Upload Files
Upload these essential files:
- `app.py` (main application)
- `requirements.txt` (dependencies)
- `config.yaml` (space configuration)
- `README.md` (documentation)
- `packages.txt` (system dependencies)
- `Dockerfile` (optional)

### 3. Configure Secrets
In Space settings, add:
- `GEMINI_API_KEY`: Your Google AI API key
- `ELEVENLABS_API_KEY`: Your ElevenLabs API key (optional)

### 4. Space Configuration (config.yaml)
```yaml

title: "🍌 Nano Banana: Dynamic Image Creation"

emoji: 🍌

colorFrom: yellow

colorTo: orange

sdk: gradio

sdk_version: "4.44.0"

app_file: app.py

```

### 5. API Keys Setup

#### Gemini API Key (Required)
1. Visit [Google AI Studio](https://makersuite.google.com/app/apikey)
2. Create new API key
3. Add to Space secrets as `GEMINI_API_KEY`

#### ElevenLabs API Key (Optional)
1. Sign up at [ElevenLabs](https://elevenlabs.io/)
2. Get API key from dashboard
3. Add to Space secrets as `ELEVENLABS_API_KEY`

### 6. Deployment Process
1. Upload files to Space
2. Add API keys in Settings > Variables and secrets
3. Space will automatically build and deploy
4. Access your live demo at the Space URL

### 7. Edge Cases Handled
- βœ… Missing API keys (graceful degradation)
- βœ… Rate limiting (automatic retry with backoff)
- βœ… Large images (automatic resizing)
- βœ… Network timeouts (retry mechanism)
- βœ… Invalid prompts (validation)
- βœ… Optional features fallback

### 8. Performance Optimizations
- Image compression and resizing
- Rate limiting compliance (20 images/minute)
- Efficient memory usage
- Error recovery mechanisms

### 9. Competition Compliance
- Gemini 2.5 Flash Image as primary model
- Optional enhancements (YOLO, ElevenLabs)
- Public accessibility without login
- Video demo ready interface