### Setup Flatpak Dependencies Source: https://github.com/ladaapp/lada/blob/main/packaging/flatpak/README.md Add the Flathub remote repository and install the Flatpak Builder tool. These are prerequisites for building the Flatpak locally. ```shell flatpak remote-add --if-not-exists --user flathub https://dl.flathub.org/repo/flathub.flatpakrepo flatpak install --user -y flathub org.flatpak.Builder ``` -------------------------------- ### Install System Dependencies on Arch Linux Source: https://github.com/ladaapp/lada/blob/main/docs/linux_install.md Installs uv, FFmpeg, and git on Arch Linux using pacman. ```bash sudo pacman -Syu uv ffmpeg git ``` -------------------------------- ### Install System Dependencies on Ubuntu Source: https://github.com/ladaapp/lada/blob/main/docs/linux_install.md Installs FFmpeg and git on Ubuntu. Note that 'uv' is not available in default repositories. ```bash sudo apt install ffmpeg git ``` -------------------------------- ### Install LabelMe for Annotation Source: https://github.com/ladaapp/lada/blob/main/docs/training_and_dataset_creation.md Sets up a virtual environment and installs the labelme tool for image annotation. Use this environment only for annotation tasks. ```shell python -m venv .venv_labelme source .venv_labelme/bin/activate pip install labelme ``` -------------------------------- ### Install System Dependencies with Homebrew Source: https://github.com/ladaapp/lada/blob/main/docs/macOS_install.md Installs essential system dependencies like FFmpeg, git, and uv using Homebrew. Ensure Homebrew is installed before running this command. ```bash brew install ffmpeg git uv ``` -------------------------------- ### Build and Install Lada Flatpak Extensions Locally Source: https://github.com/ladaapp/lada/blob/main/packaging/flatpak/README.md Build and install specific Lada Flatpak extensions (Nvidia or Intel) using the Flatpak Builder. Only one extension should be installed at a time. ```shell # Nvidia flatpak run org.flatpak.Builder --force-clean --user --install --install-deps-from=flathub build_flatpak packaging/flatpak/extension_nvidia/io.github.ladaapp.lada.extensions.nvidia.yaml # Intel flatpak run org.flatpak.Builder --force-clean --user --install --install-deps-from=flathub build_flatpak packaging/flatpak/extension_intel/io.github.ladaapp.lada.extensions.intel.yaml ``` -------------------------------- ### Install GUI Dependencies on Ubuntu 25.04 Source: https://github.com/ladaapp/lada/blob/main/docs/linux_install.md Installs necessary system dependencies for the GUI on Ubuntu 25.04 using apt. ```bash sudo apt install gcc python3-dev pkg-config libgirepository-2.0-dev libcairo2-dev libadwaita-1-dev gir1.2-gstreamer-1.0 sudo apt install libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev gstreamer1.0-plugins-good gstreamer1.0-plugins-bad gstreamer1.0-plugins-ugly gstreamer1.0-pulseaudio gstreamer1.0-alsa gstreamer1.0-tools gstreamer1.0-libav gstreamer1.0-gtk4 ``` -------------------------------- ### Build and Install Lada Flatpak Locally Source: https://github.com/ladaapp/lada/blob/main/packaging/flatpak/README.md Build and install the main Lada Flatpak using the Flatpak Builder. Ensure to use the correct manifest file. ```shell flatpak run org.flatpak.Builder --force-clean --user --install --install-deps-from=flathub build_flatpak packaging/flatpak/main/io.github.ladaapp.lada.yaml ``` -------------------------------- ### Install GTK 4, Libadwaita, and GStreamer Source: https://github.com/ladaapp/lada/blob/main/docs/macOS_install.md Installs the necessary graphical toolkit components (GTK 4, Libadwaita) and GStreamer for video playback in the Lada GUI using Homebrew. Ensure Homebrew is installed. ```bash brew install gtk4 libadwaita adwaita-icon-theme gstreamer ``` -------------------------------- ### Build and Install Gstreamer gtk4 Plugin on Ubuntu 24.04 Source: https://github.com/ladaapp/lada/blob/main/docs/linux_install.md Builds and installs the Gstreamer gtk4 plugin from source on Ubuntu 24.04, as it's not available in the repositories. This involves cloning the repository, installing build dependencies, and using cargo to build and install the plugin. ```bash # Get the source code git clone https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git cd gst-plugins-rs # Install dependencies necessary to build the plugin sudo apt install rustup libssl-dev rustup default stable cargo install cargo-c # Now we can build and install the plugin. Note that we're installing to the system directory, you might want to adjust this to another directory and set set the environment variable GST_PLUGIN_PATH accordingly cargo cbuild -p gst-plugin-gtk4 --libdir /usr/lib/x86_64-linux-gnu sudo -E cargo cinstall -p gst-plugin-gtk4 --libdir /usr/lib/x86_64-linux-gnu # If the following command does not return an error the plugin is correctly installed gst-inspect-1.0 gtk4paintablesink ``` -------------------------------- ### Install Translation System Dependencies on Ubuntu Source: https://github.com/ladaapp/lada/blob/main/docs/linux_install.md Installs the 'gettext' utility on Ubuntu, which is required for compiling translation files. ```bash sudo apt install gettext ``` -------------------------------- ### Install Intel VPL GPU Runtime on Ubuntu Source: https://github.com/ladaapp/lada/blob/main/docs/linux_install.md Installs the Intel VPL GPU Runtime on Ubuntu for QSV hardware video encoding. ```bash sudo apt install libmfx-gen1.2 ``` -------------------------------- ### Prepare Build Environment with uv Source: https://github.com/ladaapp/lada/blob/main/docs/windows_install.md Sets up a virtual environment for building GUI dependencies using uv and installs required Python packages. This should be run in a regular PowerShell window. ```powershell uv venv venv_gtk .\venv_gtk\Scripts\Activate.ps1 uv pip install gvsbuild==2026.1.0 uv pip install patch uv run --no-project python -m patch -p1 -d venv_gtk/lib/site-packages patches/gvsbuild_ffmpeg.patch uv pip uninstall patch ``` -------------------------------- ### Install Python Dependencies for GUI Source: https://github.com/ladaapp/lada/blob/main/docs/windows_install.md Installs the compiled Python wheels for GUI dependencies. Use --force-reinstall to ensure the correct versions are installed. ```powershell uv pip install --force-reinstall (Resolve-Path ".\build_gtk\gtk\x64\release\python\pygobject*.whl") uv pip install --force-reinstall (Resolve-Path ".\build_gtk\gtk\x64\release\python\pycairo*.whl") ``` -------------------------------- ### Create and Activate Virtual Environment with Dependencies Source: https://github.com/ladaapp/lada/blob/main/docs/macOS_install.md Creates a Python virtual environment using uv, activates it, and installs project dependencies, including CPU/MPS support for PyTorch. ```bash uv venv source .venv/bin/activate uv sync --extra cpu ``` -------------------------------- ### Install GUI Dependencies on Arch Linux Source: https://github.com/ladaapp/lada/blob/main/docs/linux_install.md Installs necessary system dependencies for the GUI on Arch Linux using pacman. ```bash sudo pacman -Syu python-gobject gtk4 libadwaita gstreamer gst-plugins-base gst-plugins-good gst-plugins-bad gst-plugins-ugly gst-plugins-base-libs gst-plugins-bad-libs gst-plugin-gtk4 ``` -------------------------------- ### Install System Dependencies with winget Source: https://github.com/ladaapp/lada/blob/main/docs/windows_install.md Installs FFmpeg, Git, and uv using the Windows Package Manager (winget). Ensure PowerShell is run as Administrator. Sets the execution policy to RemoteSigned. ```powershell winget install --id Gyan.FFmpeg -e --source winget winget install --id Git.Git -e --source winget winget install --id astral-sh.uv -e --source winget set-ExecutionPolicy RemoteSigned ``` -------------------------------- ### Install GUI Development Dependencies Source: https://github.com/ladaapp/lada/blob/main/docs/windows_install.md Installs the 'gui-dev' group of Python dependencies, which is recommended if you plan to work on the GUI code. ```powershell uv pip install --group gui-dev ``` -------------------------------- ### Install Python Dependencies for GUI Source: https://github.com/ladaapp/lada/blob/main/docs/linux_install.md Installs the Python dependencies required for the GUI, including development group if needed. ```bash uv pip install -e '.[gui]' ``` ```bash uv pip install --group gui-dev ``` -------------------------------- ### Install GUI Dependencies Source: https://github.com/ladaapp/lada/blob/main/docs/macOS_install.md Installs the Python dependencies required for the Lada GUI, including pycairo and PyGObject. This command should be run within the activated virtual environment. ```bash uv sync --extra gui ``` -------------------------------- ### Install Intel VPL GPU Runtime on Arch Linux Source: https://github.com/ladaapp/lada/blob/main/docs/linux_install.md Installs the Intel VPL GPU Runtime on Arch Linux for QSV hardware video encoding. ```bash sudo pacman -S vpl-gpu-rt ``` -------------------------------- ### Install GUI Dependencies on Ubuntu 24.04 Source: https://github.com/ladaapp/lada/blob/main/docs/linux_install.md Installs necessary system dependencies for the GUI on Ubuntu 24.04 using apt. Note that the Gstreamer gtk4 plugin needs to be built from source. ```bash sudo apt install gcc python3-dev pkg-config libgirepository-2.0-dev libcairo2-dev libadwaita-1-dev gir1.2-gstreamer-1.0 sudo apt install libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev gstreamer1.0-plugins-good gstreamer1.0-plugins-bad gstreamer1.0-plugins-ugly gstreamer1.0-pulseaudio gstreamer1.0-alsa gstreamer1.0-tools gstreamer1.0-libav ``` -------------------------------- ### Install GUI Python Extras Source: https://github.com/ladaapp/lada/blob/main/packaging/macOS/README.md Synchronize project dependencies, including CPU and GUI extras, and exclude default groups for GUI builds. ```bash uv sync --extra cpu --extra gui --no-default-groups ``` -------------------------------- ### Install Python Development Dependencies Source: https://github.com/ladaapp/lada/blob/main/docs/training_and_dataset_creation.md Installs Python dependencies for development using uv. The --inexact flag allows for version flexibility. ```bash uv sync --group dev --inexact ``` -------------------------------- ### Install Build Tools with winget Source: https://github.com/ladaapp/lada/blob/main/docs/windows_install.md Installs necessary build tools for the GUI using the Windows Package Manager (winget). Ensure PowerShell is run as Administrator. ```powershell winget install --id MSYS2.MSYS2 -e --source winget winget install --id Microsoft.VisualStudio.2022.BuildTools -e --source winget --silent --override "--wait --quiet --add ProductLang En-us --add Microsoft.VisualStudio.Workload.VCTools --includeRecommended" winget install --id Rustlang.Rustup -e --source winget winget install --id Microsoft.VCRedist.2013.x64 -e --source winget winget install --id Microsoft.VCRedist.2013.x86 -e --source winget ``` -------------------------------- ### Install and Compile Translations Source: https://github.com/ladaapp/lada/blob/main/docs/macOS_install.md Installs the gettext utility and compiles translation files for the Lada application. This allows the app to be displayed in languages other than English. ```bash brew install gettext bash translations/compile_po.sh ``` -------------------------------- ### Install Translation System Dependencies on Arch Linux Source: https://github.com/ladaapp/lada/blob/main/docs/linux_install.md Installs the 'gettext' utility on Arch Linux, which is required for compiling translation files. ```bash sudo pacman -Syu gettext ``` -------------------------------- ### Start LabelMe Annotation Tool Source: https://github.com/ladaapp/lada/blob/main/docs/training_and_dataset_creation.md Launches the labelme tool to begin annotating NSFW content. Use 'nsfw' for NSFW regions and 'sfw' for non-NSFW images without drawing polygons. ```shell labelme --flags sfw --labels nsfw --nodata --autosave datasets/nsfw_detection_labelme/train ``` -------------------------------- ### Install Python Dependencies with GPU Support Source: https://github.com/ladaapp/lada/blob/main/docs/windows_install.md Installs Python dependencies using 'uv sync', specifying an 'extra' for GPU support (e.g., 'nvidia'). Adjust the 'extra' parameter based on your hardware. ```bash uv sync --extra nvidia # Adjust extra according to your available hardware ``` -------------------------------- ### Build Lada CLI and GUI on macOS Source: https://github.com/ladaapp/lada/blob/main/packaging/macOS/README.md Install PyInstaller and then use it to build the Lada application from the project root. Ensure GUI extras are included if building the GUI. ```bash uv sync --extra cpu --extra gui --no-default-groups # include gui for Lada.app ``` ```bash uv pip install pyinstaller ``` ```bash uv run pyinstaller --noconfirm packaging/macOS/lada.spec ``` -------------------------------- ### Install Python Dependencies with GPU Support Source: https://github.com/ladaapp/lada/blob/main/docs/linux_install.md Installs Python dependencies using uv, specifying the 'nvidia' extra for Nvidia GPU support. Adjust the 'extra' to match your hardware. ```bash uv sync --extra nvidia # Adjust extra to your available hardware ``` -------------------------------- ### Activate Virtual Environment and Run CLI Source: https://github.com/ladaapp/lada/blob/main/docs/windows_install.md Navigate to the project root, activate the Python virtual environment, and then run the Lada CLI. ```powershell cd into the project root directory Activate the virtual environment with .\.venv\Scripts\Activate.ps1 Run the CLI with lada-cli ``` -------------------------------- ### Run Lada GUI Application Source: https://github.com/ladaapp/lada/blob/main/packaging/macOS/README.md Open the Lada GUI application bundle from Finder or the Terminal. ```bash open dist/Lada.app ``` -------------------------------- ### Create and Activate Virtual Environment Source: https://github.com/ladaapp/lada/blob/main/docs/linux_install.md Creates a Python virtual environment using uv and activates it. ```bash uv venv source .venv/bin/activate ``` -------------------------------- ### Create Dataset Directories for LabelMe Source: https://github.com/ladaapp/lada/blob/main/docs/training_and_dataset_creation.md Initializes the directory structure required for the NSFW detection dataset using labelme. ```shell mkdir -p datasets/nsfw_detection_labelme/{train,val} ``` -------------------------------- ### Activate Virtual Environment and Run CLI Source: https://github.com/ladaapp/lada/blob/main/docs/linux_install.md Instructions for activating the Python virtual environment and running the Lada CLI. Ensure you are in the project root directory. ```shell .venv\Scripts\Activate.ps1 lada-cli ``` -------------------------------- ### Standard GPL Notice for Source Files Source: https://github.com/ladaapp/lada/blob/main/LICENSES/GPL-3.0-or-later.txt Include this notice at the beginning of each source file to state the exclusion of warranty and provide licensing information. Ensure the copyright line and a pointer to the full notice are present. ```text Copyright (C) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . ``` -------------------------------- ### Run Lada Flatpak Locally Source: https://github.com/ladaapp/lada/blob/main/packaging/flatpak/README.md Run the locally installed Lada Flatpak using its specific command. This is useful for testing the development build. ```shell flatpak run io.github.ladaapp.lada//main ``` -------------------------------- ### Clone Lada Repository and Navigate Source: https://github.com/ladaapp/lada/blob/main/docs/macOS_install.md Clones the Lada source code from its repository and changes the current directory to the project root. ```bash git clone https://codeberg.org/ladaapp/lada.git cd lada ``` -------------------------------- ### Train Watermark Detection Model Source: https://github.com/ladaapp/lada/blob/main/docs/training_and_dataset_creation.md Starts the training procedure for the watermark detection model using YOLO. This command should be executed after the dataset has been successfully created and formatted. ```shell python scripts/training/train-watermark-detection-yolo.py ``` -------------------------------- ### Run Lada GUI Source: https://github.com/ladaapp/lada/blob/main/docs/macOS_install.md Launches the Lada GUI application. This can be run directly if the project is in the current directory and the virtual environment is active, or via uv run. ```bash lada ``` ```bash uv run lada ``` -------------------------------- ### GPL Notice for Interactive Terminal Programs Source: https://github.com/ladaapp/lada/blob/main/LICENSES/GPL-3.0-or-later.txt If your program interacts with the terminal, display this notice upon starting in interactive mode. It informs users about the warranty and redistribution conditions. ```text Copyright (C) This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. ``` -------------------------------- ### Build Windows Executable Source: https://github.com/ladaapp/lada/blob/main/packaging/windows/README.md Use this command to build the Windows executable. The `-extra` flag allows specifying additional components like 'nvidia'. Other flags can be used to skip certain build steps. ```powershell powershell -ExecutionPolicy Bypass ./packaging/windows/package_executable.ps1 -extra nvidia ``` -------------------------------- ### Set Language Environment Variable Source: https://github.com/ladaapp/lada/blob/main/docs/windows_install.md Sets the LANGUAGE environment variable to a specific locale, for example, 'zh_CN'. This is an alternative method to setting the system's display language for translations. ```powershell $env:LANGUAGE = "zh_CN" ``` -------------------------------- ### Download Model Weights Source: https://github.com/ladaapp/lada/blob/main/docs/training_and_dataset_creation.md Downloads necessary pre-trained model weights for training and dataset creation. Ensure the target directories exist. ```shell wget -P model_weights/3rd_party/ 'https://download.openmmlab.com/mmiediting/restorers/basicvsr/spynet_20210409-c6c1bd09.pth' wget -P model_weights/3rd_party/ 'https://download.pytorch.org/models/vgg19-dcbb9e9d.pth' wget -P model_weights/3rd_party/ 'https://github.com/QualityAssessment/DOVER/releases/download/v0.1.0/DOVER.pth' wget -P model_weights/ 'https://huggingface.co/ladaapp/lada/resolve/main/lada_nsfw_detection_model_v1.3.pt?download=true' wget -P model_weights/ 'https://huggingface.co/ladaapp/lada/resolve/main/lada_watermark_detection_model_v1.3.pt?download=true' wget -P model_weights/3rd_party/ 'https://github.com/notAI-tech/NudeNet/releases/download/v3.4-weights/640m.pt' wget -P model_weights/3rd_party/ 'https://github.com/ORB-HD/deface/raw/refs/tags/v1.5.0/deface/centerface.onnx' wget -P model_weights/3rd_party/ 'https://huggingface.co/HoyerChou/BPJDet/resolve/main/ch_head_s_1536_e150_best_mMR.pt?download=true' ``` -------------------------------- ### Run Lada CLI via Docker Source: https://github.com/ladaapp/lada/blob/main/README.md This command pulls the latest LadaApp Docker image from Docker Hub. Ensure you have Docker installed and configured for GPU usage if needed. ```shell docker pull ladaapp/lada:latest ``` -------------------------------- ### Download Lada Model Weights Source: https://github.com/ladaapp/lada/blob/main/docs/windows_install.md Use Invoke-WebRequest to download the required model weights for Lada. Ensure the target directory exists. ```powershell Invoke-WebRequest 'https://huggingface.co/ladaapp/lada/resolve/main/lada_mosaic_detection_model_v4_accurate.pt?download=true' -OutFile ".\model_weights\lada_mosaic_detection_model_v4_accurate.pt" ``` ```powershell Invoke-WebRequest 'https://huggingface.co/ladaapp/lada/resolve/main/lada_mosaic_detection_model_v4_fast.pt?download=true' -OutFile ".\model_weights\lada_mosaic_detection_model_v4_fast.pt" ``` ```powershell Invoke-WebRequest 'https://huggingface.co/ladaapp/lada/resolve/main/lada_mosaic_restoration_model_generic_v1.2.pth?download=true' -OutFile ".\model_weights\lada_mosaic_restoration_model_generic_v1.2.pth" ``` -------------------------------- ### Create and Activate Virtual Environment Source: https://github.com/ladaapp/lada/blob/main/docs/windows_install.md Creates a new virtual environment using 'uv' and activates it. The activation script is located in the .venv\Scripts directory. ```powershell uv venv .\.venv\Scripts\Activate.ps1 ``` -------------------------------- ### Add Gettext to PATH Source: https://github.com/ladaapp/lada/blob/main/docs/windows_install.md Adds the directory containing the extracted gettext tools to the system's PATH environment variable. This is necessary for compiling translations if gettext was not installed with the GUI dependencies. ```powershell $env:Path = "";" + $env:Path ```