Spaces:
Sleeping
Sleeping
Commit ·
267f464
1
Parent(s): f201243
corrected the readme
Browse files
README.md
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
# Ad Generator Lite
|
| 2 |
|
| 3 |
Generate high-converting ad creatives for Home Insurance and GLP-1 niches using psychological triggers and AI-powered image generation.
|
|
@@ -35,7 +47,20 @@ Required variables:
|
|
| 35 |
|
| 36 |
Optional variables:
|
| 37 |
- `MONGODB_URL`: MongoDB connection string (for database features)
|
| 38 |
-
- R2 Storage credentials (for cloud image storage)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 39 |
|
| 40 |
### Running Locally
|
| 41 |
|
|
@@ -96,6 +121,22 @@ The `huggingface.yml` file configures:
|
|
| 96 |
- Port 8000 for the FastAPI app
|
| 97 |
- Health check endpoint
|
| 98 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 99 |
### Accessing Your Deployed App
|
| 100 |
|
| 101 |
Once deployed, your app will be available at:
|
|
@@ -131,6 +172,11 @@ https://your-username-ad-generator-lite.hf.space
|
|
| 131 |
- `GET /db/ad/{ad_id}` - Get specific ad
|
| 132 |
- `DELETE /db/ad/{ad_id}` - Delete ad (requires auth)
|
| 133 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 134 |
### Health
|
| 135 |
- `GET /health` - Health check
|
| 136 |
- `GET /` - API information
|
|
|
|
| 1 |
+
---
|
| 2 |
+
title: Ad Generator Lite
|
| 3 |
+
emoji: 🎨
|
| 4 |
+
colorFrom: blue
|
| 5 |
+
colorTo: purple
|
| 6 |
+
sdk: docker
|
| 7 |
+
sdk_version: "latest"
|
| 8 |
+
app_file: main.py
|
| 9 |
+
pinned: false
|
| 10 |
+
---
|
| 11 |
+
|
| 12 |
+
|
| 13 |
# Ad Generator Lite
|
| 14 |
|
| 15 |
Generate high-converting ad creatives for Home Insurance and GLP-1 niches using psychological triggers and AI-powered image generation.
|
|
|
|
| 47 |
|
| 48 |
Optional variables:
|
| 49 |
- `MONGODB_URL`: MongoDB connection string (for database features)
|
| 50 |
+
- R2 Storage credentials (for cloud image storage):
|
| 51 |
+
- `R2_ENDPOINT`: Cloudflare R2 endpoint URL
|
| 52 |
+
- `R2_BUCKET_NAME`: R2 bucket name
|
| 53 |
+
- `R2_ACCESS_KEY`: R2 access key
|
| 54 |
+
- `R2_SECRET_KEY`: R2 secret key
|
| 55 |
+
- `R2_PUBLIC_DOMAIN`: Optional custom domain for public URLs
|
| 56 |
+
|
| 57 |
+
Production & Storage Settings:
|
| 58 |
+
- `ENVIRONMENT`: Set to `"production"` for production deployment (default: `"development"`)
|
| 59 |
+
- `SAVE_IMAGES_LOCALLY`: Whether to save images locally (default: `true`)
|
| 60 |
+
- In production: Set to `false` to disable local storage completely
|
| 61 |
+
- In production: Set to `true` to save temporarily (will be auto-deleted after retention period)
|
| 62 |
+
- `LOCAL_IMAGE_RETENTION_HOURS`: Hours to keep images locally before cleanup (default: `24`)
|
| 63 |
+
- Only applies when `ENVIRONMENT=production` and `SAVE_IMAGES_LOCALLY=true`
|
| 64 |
|
| 65 |
### Running Locally
|
| 66 |
|
|
|
|
| 121 |
- Port 8000 for the FastAPI app
|
| 122 |
- Health check endpoint
|
| 123 |
|
| 124 |
+
### Production Configuration
|
| 125 |
+
|
| 126 |
+
For production deployments on Hugging Face Spaces, set these environment variables:
|
| 127 |
+
|
| 128 |
+
```bash
|
| 129 |
+
ENVIRONMENT=production
|
| 130 |
+
SAVE_IMAGES_LOCALLY=true # Set to false to disable local storage completely
|
| 131 |
+
LOCAL_IMAGE_RETENTION_HOURS=24 # Images older than this will be auto-deleted
|
| 132 |
+
```
|
| 133 |
+
|
| 134 |
+
**Important Notes:**
|
| 135 |
+
- In production with `SAVE_IMAGES_LOCALLY=true`: Images are saved temporarily and automatically cleaned up after the retention period
|
| 136 |
+
- In production with `SAVE_IMAGES_LOCALLY=false`: Images are NOT saved locally (only uploaded to R2)
|
| 137 |
+
- Automatic cleanup runs every hour in production
|
| 138 |
+
- Use the `/admin/storage/stats` endpoint to monitor storage usage
|
| 139 |
+
|
| 140 |
### Accessing Your Deployed App
|
| 141 |
|
| 142 |
Once deployed, your app will be available at:
|
|
|
|
| 172 |
- `GET /db/ad/{ad_id}` - Get specific ad
|
| 173 |
- `DELETE /db/ad/{ad_id}` - Delete ad (requires auth)
|
| 174 |
|
| 175 |
+
### Admin (Storage Management)
|
| 176 |
+
- `GET /admin/storage/stats` - Get storage statistics for locally saved images (requires auth)
|
| 177 |
+
- `POST /admin/storage/cleanup` - Manually trigger image cleanup (requires auth)
|
| 178 |
+
- Query parameter: `dry_run=true` to preview what would be deleted
|
| 179 |
+
|
| 180 |
### Health
|
| 181 |
- `GET /health` - Health check
|
| 182 |
- `GET /` - API information
|