Step 2: Shell script to set up environment and run
Save this as setup_and_run.sh:
bash
#!/bin/bash
# Exit on error
set -e
echo "Creating Python virtual environment..."
python3 -m venv venv
echo "Activating virtual environment..."
source venv/bin/activate
echo "Upgrading pip..."
pip install --upgrade pip
echo "Installing dependencies optimized for Mac Silicon M3 Pro..."
# Install torch with MPS support for Mac Silicon
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu
# Install diffusers and transformers
pip install diffusers transformers accelerate
# Install Pillow and OpenCV
pip install pillow opencv-python
echo "All dependencies installed."
echo "Running the landscape generator..."
python3 landscape_generator_mac.py
Step 3: Usage instructions
Save the Python script as landscape_generator_mac.py.
Save the shell script as setup_and_run.sh.
Make the shell script executable:
bash
chmod +x setup_and_run.sh
Run the shell script:
bash
./setup_and_run.sh
Notes:
The script creates a virtual environment, installs all dependencies, and runs the app.
The PyTorch install line uses the CPU wheels because official MPS wheels are included in the main PyTorch package for macOS. If you want the latest MPS support, you can install from the main PyTorch instructions for Mac Silicon:
bash
pip install torch torchvision torchaudio
The script assumes you have Python 3.8+ installed.
The GUI will open and generate blurred landscapes every 5 seconds using the MPS device if available.
If you want me to help you package this as a standalone Mac app or add more features, just ask!