AB
AiBoss
Tutorials

How to install and use DragGAN? 4 methods for running it online and locally.

DragGAN is a popular open-source AI image project and research. This article will introduce how to run, install, and use DragGAN, including various methods for online operation and local use.

如何安装和使用DragGAN?在线和本地运行的4种方法

DragGAN is aPopularofopen sourceAIImage projects and research allow for flexible and precise control over the pose, shape, expression, and orientation of static objects in images through dragging. This enables actions such as opening an animal's mouth, changing the angle of a car, or elevating a mountain in a landscape. Recently, the DragGAN team...GitHubGo online andopen sourceHaving covered its official implementation project, this article will introduce how to run, install, and use DragGAN, including various methods for online operation and local use.

Table of Contents:

Running and using DragGAN online

If you just want to try out the effects of DragGAN, then running DragGAN online is a better option. Here we will introduce three methods to use DragGAN online: OpenXLab, Hugging Face, and Google Colab.

Running via OpenXLab

OpenXLab Puyuan is a project of "Shanghai"artificialintelligentThe laboratory launchedAIThe model community and hosting platform are similar to Hugging Face, which will be discussed below. The DragGAN team provides an official implementation of the DragGAN project on OpenXLab, where users can visit the website to run DragGAN and test the drag-and-drop effect.

Run address:https://openxlab.org.cn/apps/detail/XingangPan/DragGAN

Running via Hugging Face

Hugging Face is a well-known...open sourceAIModel community, this platform brings together various typesAIModel, dataset, and runtime space. The DragGAN project.open sourceAfter its launch, the official team immediately created a project space on Hugging Face, which interested users can access at any time to test its performance.

Run address:https://huggingface.co/spaces/DragGan/DragGan

Use via Google Colab

Google Colab is a cloud platform launched by Google that allows users to write, run, and share Python code using the Jupyter notebook environment. Google Colab is...freeThe service provides users with virtual machines, including access to high-performance CPU, GPU, and TPU resources, as well as pre-installed libraries such as TensorFlow and PyTorch. If you are a technical professional, you can choose this method: open the run address below, select GPU in the settings, and run the installation code and demo code blocks.

Run address:https://colab.research.google.com/drive/1mey-IXPwQC_qSthI5hO-LTX7QL4ivtPh?usp=sharing

Local installation and use of DragGAN

If you want to install and deploy DragGAN locally on your computer, simply follow the instructions on the DragGAN GitHub project. Please download and install it before proceeding.Git,PythonandCondaThe specific steps are as follows:

Step 1: Clone the official DragGAN project

Open a command prompt or terminal and use the git command.git clone https://github.com/XingangPan/DragGAN.gitClone the official project to your desired folder.

Step 2: Set up CUDA and install the Python environment

  1. After cloning is complete, use the cd command.cd DragGANEnter this folder
  2. Then set up the conda environment:conda env create -f environment.yml(Note: If you are running a Mac, please edit the environment.yml file and delete...)- cudatoolkit=11.1This is because Macs do not use NVIDIA GPUs. Additionally, Macs need to be configured to run on the CPU, which can be done in the terminal.export PYTORCH_ENABLE_MPS_FALLBACK=1
  3. Activate the conda environment:conda activate stylegan3
  4. Install the necessary dependencies:pip install -r requirements

Step 3: Download the pre-trained model

Use commandspython scripts/download_model.pydownload

Step 4: Set up the DragGAN GUI interface and run it.

Use commandspython visualizer_drag_gradio.pyDownload the Grado-based interface. After downloading and installing, copy the local address from the "Running on local URL" field in the terminal.http://127.0.0.1:7860Then it can be run in your local browser.

The above isAIThis toolkit provides a guide on how to run DragGAN. If you encounter any problems during installation and use, please leave a comment or seek help from the official DragGAN GitHub project.

How to run Stable Diffusion? 5 methods for running it online and locally.

How to get rid of dreamingAIImage/video watermarks? Two methods without a membership.