DisC-Illustrations/diffusion-backend

provides a custom Python backend to allow HuggingFace based diffusion to be utilized via an API

0

stars

49

commits

Python

primary language

Mar 26, 2025

updated

README

diffusion-backend

Run the app

Windows:

python -m venv venv
venv\Scripts\activate
pip install -r requirements.txt --user
python app.py

MacOS/Linux:

source run_mac.sh

Get the correct version of Pytorch here: https://pytorch.org/get-started/locally/

Environment variables

  • OPENAI_API_KEY: API key for OpenAI

Docker

When using Docker, you can build the image with the following command:

docker build -t diffusion-backend .

Then, you can run the image with the following command:

docker run -p 5000:<local_port> diffusion-backend

Replace <local_port> with the port you want to use locally. E.g.:

docker run -p 5000:55000 diffusion-backend

Pytorch and CUDA

If you want to use Pytorch with CUDA on Windows, you have to install the CUDA version of Pytorch.

pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118

Contributors

joshuabrandes

44 commits

carasiov

5 commits

DisC-Illustrations/diffusion-backend

provides a custom Python backend to allow HuggingFace based diffusion to be utilized via an API

0

stars

49

commits

Python

primary language

Mar 26, 2025

updated

README

diffusion-backend

Run the app

Windows:

python -m venv venv
venv\Scripts\activate
pip install -r requirements.txt --user
python app.py

MacOS/Linux:

source run_mac.sh

Get the correct version of Pytorch here: https://pytorch.org/get-started/locally/

Environment variables

  • OPENAI_API_KEY: API key for OpenAI

Docker

When using Docker, you can build the image with the following command:

docker build -t diffusion-backend .

Then, you can run the image with the following command:

docker run -p 5000:<local_port> diffusion-backend

Replace <local_port> with the port you want to use locally. E.g.:

docker run -p 5000:55000 diffusion-backend

Pytorch and CUDA

If you want to use Pytorch with CUDA on Windows, you have to install the CUDA version of Pytorch.

pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118

Contributors

joshuabrandes

44 commits

carasiov

5 commits

Languages

Python

92.8%

Dockerfile

2.9%

Shell

2.7%

Batchfile

1.7%