Spaces:
Running
Running
title: StickerGen | |
emoji: 🚀 | |
colorFrom: indigo | |
colorTo: pink | |
sdk: docker | |
pinned: false | |
# Hugging Face Space: Image to Chibi/Anime/Cartoon Sticker Generator | |
This Space provides an API endpoint `/generate` that: | |
1. Accepts an image and a style (chibi, anime, cartoon, etc.). | |
2. Captions the image using BLIP. | |
3. Constructs a DALL·E 3 prompt and calls OpenAI's API to generate a set of stickers. | |
4. Returns the generated sticker image URL. | |
## Flow (Numbered) | |
1. **User uploads an image** (`image`) and specifies a sticker style (`style`). | |
2. **App generates a caption** using BLIP (image captioning). | |
3. **App constructs a DALL·E 3 prompt** combining the style and generated caption. | |
4. **App sends the prompt to OpenAI DALL·E 3** and retrieves a sticker image URL. | |
5. **App returns a JSON** containing the caption, prompt, and image URL. | |
## Usage | |
### POST `/generate` | |
- `image`: (file, required) — Input image (JPEG/PNG). | |
- `style`: (text, optional, default: "chibi") — Sticker style ("chibi", "anime", "cartoon", etc.). | |
#### Response | |
```json | |
{ | |
"caption": "...", | |
"prompt": "...", | |
"image_url": "..." | |
} | |
``` | |
### Requirements | |
- Hugging Face installs dependencies from `requirements.txt` | |
- Set your OpenAI API key as environment variable: | |
`OPENAI_API_KEY=sk-...` | |
### Running locally | |
```bash | |
uvicorn app:app --reload | |
``` |