Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/visheshc14/stablediffusion-fastapi
NimbleBox Apprenticeship ML Engineer Task - 2. Stable diffusion doesn't actually apply noise to images, it uses a compressed low dimensional latent representation of the image and applies noise to that. The model is running in this abstract latent space, and then the autoencoder recreates the image afterwards.
https://github.com/visheshc14/stablediffusion-fastapi
Last synced: 5 days ago
JSON representation
NimbleBox Apprenticeship ML Engineer Task - 2. Stable diffusion doesn't actually apply noise to images, it uses a compressed low dimensional latent representation of the image and applies noise to that. The model is running in this abstract latent space, and then the autoencoder recreates the image afterwards.
- Host: GitHub
- URL: https://github.com/visheshc14/stablediffusion-fastapi
- Owner: visheshc14
- Created: 2023-06-01T09:45:36.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-08-30T03:37:09.000Z (over 1 year ago)
- Last Synced: 2024-11-18T13:28:57.220Z (2 months ago)
- Language: JavaScript
- Homepage:
- Size: 1.12 MB
- Stars: 4
- Watchers: 2
- Forks: 0
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Stable Diffusers FastAPI Application
This project is a FastAPI application that serves a Stable Diffusers model over HTTP/REST APIs. It allows users to generate images using the Stable Diffusion technique.
## Features
- Generate images using the Stable Diffusion technique.
- RESTful API endpoints to interact with the model.
- Integration with Pydantic for input data validation.
- Streaming response to efficiently serve generated imag## Setup
- Move to the backend folder.
- Run the following:
```bash
cd backend
touch .env
```
- Open the .env file, and paste your HF token:
```bash
HF_TOKEN=YOUR_TOKEN {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}
```
- Install requirements:
```bash
pip install -r requirements.txt
```
- Start your server:
```bash
uvicorn main:app --port 8000
```
- Run the following CURL command:
```bash
curl -X GET "localhost:8000/api/generate" -H "Content-Type: image/png" -d '{"image": "https://huggingface.co/front/thumbnails/stable_diffusion.png"}'
```
- Change to the frontend folder:
```bash
cd ../frontend
```
- Install front end dependencies and start the server:
```bash
npm install
npm start
```
## Crux: ML Engineer### Fine tune a Stable Diffusion model and serve it
- create a github repo
- create a `trainer.py` file that takes in arguments like file path `--fp` and some other training arguments and fintunes a stable diffusion model (protip: check it out on `huggingface`)
- the result of the training should be a model weight file
- create a file called `server.py` that serves the Model over a HTTP/REST over some APIs (protip: use `pydantic` for models)
- A `curl` command to call the model and get response
- an ipython notebook that contains the steps to run this