Skip to content

serverless api for ai image gen using modal.com

License

Notifications You must be signed in to change notification settings

zhaobenny/serverless-img-gen

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

serverless-img-gen

🚀 fast serverless ai image gen as an api

uses modal.com to generate images in ~2s from POST request (cold start not included)

🛠️ Usage

git clone https://github.com/zhaobenny/serverless-img-gen.git && cd serverless-img-gen
pip install modal python-dotenv
modal token new
modal deploy app.py
curl -X POST -H "Content-Type: application/json" -H "Authorization: Bearer a-good-auth-token" -d '{"prompt":"<Misato:0.4>, (masterpiece, best quality, highres), selfie, misato katsuragi, long hair, (brown eyes), blue hair, (purple hair), solo, white shirt", "negative_prompt":"FastNegativeV2"}' <URL> -o output.png

💡 Prompting

Prompt uses Compel syntax, see their docs

LoRA syntax is <Misato:0.4> in the prompt where Misato is the filename of the LoRA in loras folder, and an suitable weight after the colon.

FastNegativeV2, and Misato LyCORIS is included by default for demo purposes.

LoRAs

Place your (diffusers/diffusion model compatible) LoRAs / embeddings in the loras folder, and they will be automatically uploaded to modal.com on deployment. (make sure your embeddings are .pt and loras are .safetensors)

Check available concepts on a deployment at <URL>/loras and <URL>/embeddings

Credits

License

MIT

About

serverless api for ai image gen using modal.com

Topics

Resources

License

Stars

Watchers

Forks

Languages