https://github.com/fly-apps/cog-sd3
Run Stable Diffusion 3 Medium as a Replicate Cog on Fly.io
https://github.com/fly-apps/cog-sd3
ai gpu stable-diffusion stable-diffusion-3
Last synced: 9 months ago
JSON representation
Run Stable Diffusion 3 Medium as a Replicate Cog on Fly.io
- Host: GitHub
- URL: https://github.com/fly-apps/cog-sd3
- Owner: fly-apps
- License: apache-2.0
- Created: 2024-06-13T10:48:11.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-06-14T12:14:05.000Z (about 2 years ago)
- Last Synced: 2024-11-17T00:25:19.333Z (over 1 year ago)
- Topics: ai, gpu, stable-diffusion, stable-diffusion-3
- Language: Python
- Homepage:
- Size: 5.17 MB
- Stars: 5
- Watchers: 7
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README

Stable Diffusion 3 Medium is Stability AI's most advanced text-to-image open model yet. This demo exposes the model via a simple HTTP server, thanks to [Replicate Cog](https://github.com/replicate/cog). Cog is an open-source tool that lets you package machine learning models in a standard, production-ready container. When you're up and running, you can generate images using the `/predictions` endpoint. Images are automatically stored in object-storage on [Tigris](https://www.tigrisdata.com/) (you'll need to make sure you add a bucket to the app).
## Deploy to Fly.io
> [!IMPORTANT]
> Before you deploy, you'll need to get access to the model on Hugging Face by filling out the form in the model [repo](https://huggingface.co/stabilityai/stable-diffusion-3-medium-diffusers/tree/main).
```sh
fly apps create --name [APP_NAME]
fly storage create
fly secrets set HUGGING_FACE_HUB_TOKEN=
cog push registry.fly.io/[APP_NAME]:latest --use-cuda-base-image false
```
Now replace `image` in your fly.toml, then:
```sh
fly deploy
```
## Example Request
```sh
curl --silent https://[APP_NAME].fly.dev/predictions \
--request POST \
--header "Content-Type: application/json" \
--data @- << 'EOF'
{
"input": {
"prompt": "a magical forest",
"aspect_ratio": "3:2",
"output_quality": 100
}
}
EOF
```
Now view your image at `https://fly.storage.tigris.dev/[BUCKET_NAME]/[OUTPUT_IMAGE_NAME]`
## How can I make the endpoint private?
## Having trouble?
Create an issue or ask a question here: https://community.fly.io/