Skip to content

Instantly share code, notes, and snippets.

@awni
Last active February 24, 2025 14:33
Show Gist options
  • Save awni/a67d16d50f0f492d94a10418e0592bde to your computer and use it in GitHub Desktop.
Save awni/a67d16d50f0f492d94a10418e0592bde to your computer and use it in GitHub Desktop.

Setup the repo

git clone [email protected]:filipstrand/mflux.git
cd mflux && pip install -r requirements.txt

Make a run script

Name this anything, maybe flux.py. Make sure to update the two paths marked below.

import sys
sys.path.append("/path/to/mflux/repo/src")  # <- Update

from flux_1_schnell.config.config import Config
from flux_1_schnell.models.flux import Flux1Schnell

flux = Flux1Schnell("black-forest-labs/FLUX.1-schnell")

image = flux.generate_image(
    seed=3,
    prompt="A rocketship exactly in the style of the cartoon rocket emoji. The rocket ship is flying in the sky. The logo 'MLX' is written on the side of the ship in black letters.",
    config=Config(num_inference_steps=2)
)

image.save("/path/to/save/image.png")  # <- Update

Run the script

python flux.py

NB The model weights will be downloaded on the first run. This can take a long time.

@filipstrand
Copy link

@ivanfioravanti Added to the performance table!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment