Skip to content

Minimalist API from StableDiffusion (CompVis) Algoritms and Checkpoints.

Notifications You must be signed in to change notification settings

JohanesSetiawan/api-minimalist-sd

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

StableDiffusion API (AI Generated Images)

StableDiffusion is a state-of-the-art text to image to create an image based own your prompt. Using code from CompVis diffusions algorithms You can create and resulting beautiful image and it's free. For framework API, i used FastAPI to create an API to generate images based prompt.

Installation

  1. clone this repo
  2. create a virtual environment
python -m venv venv
  1. install requirements
pip install accelerate diffusers transformers torch fastapi uvicorn

or using requirements.txt (i don't recommend this, because it's not updated)

pip install -r requirements.txt

Note: for torch, installed using version of compute platform compatible with your GPU. For example, if you have a GPU with compute capability CUDA 11.8, install the version of PyTorch using pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118 and etc. Docs installation are available here

Usage

to run this API Server, you can run this command

uvicorn main:app --reload

and open your browser and go to https://localhost:8000/docs to see the docs and try it out.

You can change the paramater like, negative_prompt or num_inference_steps to change the result of the image, on StableDiffusion.py file.

additional: create a folder named 'results' to save the generated images. The folder is located on the root of this project.

Model or Checkpoint Changing

You can custom the model by searching on HuggingFace. For example, i use Ojimi/anime-kawai-diffusion model to generate images. You can change the model by changing the default_checkpoints variable in StableDiffusion.py file.

example:

default_checkpoints = "Ojimi/anime-kawai-diffusion"

source model or checkpoints here

Contributing

Me and My Friend

About

Minimalist API from StableDiffusion (CompVis) Algoritms and Checkpoints.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages