Skip to main content
lllyasviel /

Fooocus

A beginner-friendly image generator focused on strong defaults, with built-in inpainting, outpainting, upscaling, and image prompting.

Image GenerationBeginner Friendly
Versionae05379c
Python3.11
EnvironmentPython (uv)
InterfaceWeb UI + API
GPURequired
Securely deploy Fooocus on Laboratory OS.
Generate realistic images from text prompts.

Fooocus

Laboratory OS Installation Details

Environment

Git Repohttps://github.com/lllyasviel/Fooocus
Working Directory/workspace/Fooocus
Python3.11
Env Manageruv

Environment Variables

APP_DIRECTORY
/workspace/Fooocus
FOOOCUS_PORT
<assigned at runtime>
APP_VERSIONWhich version of the app to use, using a git branch name or commit hash.
ae05379cc97bc4361ec8b4ec90193dab21be763f
PRESET_ARGThe preset to use for the initial launch.
default

Install & Run

install-and-run.sh
#!/bin/bash
set -e

export PATH="/opt/conda/bin:/root/.local/bin:$PATH"

# Clone the GitHub repository into the directory when needed
mkdir -p "/workspace/Fooocus"
if [ -d "/workspace/Fooocus/.git" ]; then
  echo "Git repository already initialized in /workspace/Fooocus"
elif [ -z "$(ls -A "/workspace/Fooocus" 2>/dev/null)" ]; then
  git clone --progress "https://github.com/lllyasviel/Fooocus" "/workspace/Fooocus"
else
  echo "Working directory /workspace/Fooocus already exists and is not a git repository."
  echo "Leaving existing files untouched and skipping clone of https://github.com/lllyasviel/Fooocus."
fi
  
# Change to the app directory
cd "/workspace/Fooocus"

# Install the requested Python version and create a virtual environment when needed
uv python install 3.11
if [ ! -d ".venv" ]; then
  uv venv --seed --python 3.11 .venv
else
  echo "Virtual environment already exists at /workspace/Fooocus/.venv"
fi

# Activate the virtual environment
source .venv/bin/activate


# Install PyTorch
uv pip install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu128

# Environment setup complete
echo "Environment setup complete!"

python3 -m pip install -r requirements_versions.txt
# Fooocus relies on Gradio 3.41-era FastAPI internals and breaks on the newer 2026 resolver output.
python3 -m pip install "fastapi==0.99.1" "starlette==0.27.0" "pydantic==1.10.22" "anyio==3.7.1"

python3 $APP_DIRECTORY/entry_with_update.py --listen --port $FOOOCUS_PORT --preset $PRESET_ARG $OPENLAB_EXTRA_ARGS