demosmall.mov
This repo aims to be a user-friendly interface for generating images interactively using the Stable Diffusion turbo model, optimized with MLX for Apple Silicon.
-
Clone the repository:
git clone https://github.com/mark-lord/mlx-sdturbo-webui.git
, then CD into it:cd mlx-sdturbo-webui
-
Install the required dependencies (recommend using a virtual environment, but not strictly necessary):
pip install -r requirements.txt
-
Model weights should install on first-time set-up when you run the application. If they don't, then download the folder from
https://github.com/ml-explore/mlx-examples/tree/main/stable_diffusion
and runtxt2img.py
. It should download the SD-turbo weights. Then come back to this app.
If you get errors in your console, try doing pip uninstall -r requirements.txt. Then reinstall again.
Run the application with: python sd-gradio.py
This will start the Gradio interface. Open the provided URL in your web browser to access the image generator.
- Enter a text prompt describing the image you want to generate.
- Adjust the width and height sliders to set the image size.
- Set the number of generation steps and seed value.
- The script will auto-generate as you type, but you can also manually run it with the Generate Image button.
If you change the width, height or seed, you'll either need to edit your prompt to run it again, or click the Generate Image button.
The first few images on start-up are likely not to generate instantly; but once you've generated a few it tends to stabilise.
- CFG (Classifier Free Guidance) Scale: Adjust to control how closely the image follows the text prompt.
- Negative Prompt: Describe elements you want to avoid in the generated image.
Currently, these don't seem to actually change the image. Would recommend just ignoring these.
Contributions to improve are welcome! But might be ignored 😅 (don't take it personally, I have terrible time management). Please feel free to submit pull requests or open issues to suggest improvements or report bugs.
Apache 2.0
This project uses the Stable Diffusion model and is optimized with MLX for Apple Silicon. Special thanks to the team behind MLX and the open-source community!