https://github.com/kylemclaren/cog-flux
Run Flux on Fly GPUs
https://github.com/kylemclaren/cog-flux
ai flux flux-dev flux-schnell gpu img2img text2image
Last synced: 5 months ago
JSON representation
Run Flux on Fly GPUs
- Host: GitHub
- URL: https://github.com/kylemclaren/cog-flux
- Owner: kylemclaren
- License: apache-2.0
- Created: 2024-08-03T09:46:30.000Z (9 months ago)
- Default Branch: main
- Last Pushed: 2024-09-15T18:41:23.000Z (7 months ago)
- Last Synced: 2024-09-15T19:54:36.748Z (7 months ago)
- Topics: ai, flux, flux-dev, flux-schnell, gpu, img2img, text2image
- Language: Python
- Homepage:
- Size: 32.2 KB
- Stars: 1
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README

Flux is one of the most advanced text-to-image model families yet. This demo exposes the Dev model via a simple HTTP server, thanks to [Replicate Cog](https://github.com/replicate/cog). It can be adapted to use the Schnell model which is faster and comes with an Apache-2.0 license. 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
```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://cog-flux.fly.dev/predictions/test \
--request PUT \
--header "Content-Type: application/json" \
--data @- << 'EOF' | jq
{
"input": {
"prompt": "Starry night dreamscape with purple hot-air balloons",
"aspect_ratio": "16:9",
"guidance_scale": 3.5,
"num_inference_steps": 50,
"max_sequence_length": 512,
"output_format": "png"
}
}
EOF
```Now view your image at `https://fly.storage.tigris.dev/[BUCKET_NAME]/[OUTPUT_IMAGE_NAME]`
## Having trouble?
Create an issue or ask a question here: https://community.fly.io/