A image creator based on free Cloudflare AI
and HuggingFace
APIs. Features include:
- Prompt-to-image: supports a variety of models (e.g.
Flux.1
、StableDiffusion 3.5
) - Image-to-Prompt: convert local images to prompts
- AI Translation: use Chinese prompts in any model
- Store: save your creations to
IndexedDB
You can use either Fullstack
or Client-Server
mode and set the corresponding environment variables.
You may need to initialize
Cloudflare AI
llama3.2 11B vision
model before usingImage-to-Prompt
feature. See here for more information.
Set following environment variables in .env
file or Vercel
.
Key | Value | Required |
---|---|---|
CF_USER_ID |
Cloudflare user id |
✅ |
CF_AI_API_KEY |
Cloudflare AI api key |
✅ |
HF_API_KEY |
HuggingFace api key |
The free plan of
Vercel
has a limit of 10s for each request, which may cause504
error (especially when usingHuggingFace
models). You can subscribe to aVercel
paid plan, run the server locally, or useClient-Server
mode.
Deploy the server (see this project) to Cloudflare Workers
and set following environment variables in .env
file or Vercel
.
Key | Value | Required |
---|---|---|
NEXT_PUBLIC_WORKERS_SERVER |
Server url (e.g. https://api.xxx.workers.dev ) |
✅ |
Once
NEXT_PUBLIC_WORKERS_SERVER
is set, all the other environment variables will be ignored.
Deploy this project to Vercel
(remember to set environment variables when deploying).
429
error: You may have exceeded theHuggingFace
api request limit. Please wait for a while, reduce the frequency of requests, and consider subscribing to a paid plan.504
error: The request may have exceeded theVercel
time limit. See above for resolution.
For old version, see
v3
branch and https://paint.leafyee.xyz
git clone https://github.com/LeafYeeXYZ/PainterLeaf.git
cd PainterLeaf
bun install # or use other package manager you like
bun run dev
bun run build