Skip to content

Instantly share code, notes, and snippets.

@zhuguangbin
Created January 4, 2024 03:01
Show Gist options
  • Save zhuguangbin/2a6743bcbc0ed36258f18b4a2046432a to your computer and use it in GitHub Desktop.
Save zhuguangbin/2a6743bcbc0ed36258f18b4a2046432a to your computer and use it in GitHub Desktop.
SD WebUI on MLX
#!/bin/bash
# Go to the user's home directory
cd
# Check if the Conda environment 'mlx-sd' exists
if conda info --envs | grep -q "mlx-sd"; then
echo "Conda environment 'mlx-sd' already exists. Skipping creation."
else
# Create a new Conda environment named 'mlx-sd' with Python version 3.10
conda create -y -n mlx-sd python=3.10
fi
# Activate the Conda environment 'mlx-sd'
conda activate mlx-sd
# Check if the 'MLX-Stable-Diffusion-WebUI' directory exists
if [ -d "MLX-Stable-Diffusion-WebUI" ]; then
echo "'MLX-Stable-Diffusion-WebUI' directory already exists. Skipping clone."
else
# Clone the 'MLX-Stable-Diffusion-WebUI' repository from GitHub
git clone https://github.com/neobundy/MLX-Stable-Diffusion-WebUI.git
fi
# Change directory to 'MLX-Stable-Diffusion-WebUI'
cd ~/MLX-Stable-Diffusion-WebUI/
# Install Streamlit
pip install streamlit
# Install other Python dependencies from 'requirements.txt'
pip install -r requirements.txt
# Create a symbolic link to the 'models' directory if it doesn't exist
if [ ! -L "models" ]; then
ln -s ~/Library/Containers/com.liuliu.draw-things/Data/Documents/Models models
fi
# Run the 'main.py' script using Streamlit
streamlit run ~/MLX-Stable-Diffusion-WebUI/main.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment