Home >System Tutorial >Windows Series >Want Powerful Local AI Image Generation on Windows? Use This Tool

Want Powerful Local AI Image Generation on Windows? Use This Tool

王林
王林Original
2024-06-18 18:14:01715browse

AI image generation using online tools like ChatGPT, DALL-E and MidJourney is very popular, but what if you want to generate your own images using AI, on your own computer, without any restrictions? Here's the easiest way to do it on Windows.

Why Would You Want Your Own Local AI Image Generator?

Online AI image generators are incredibly powerful, and able to draw from huge amounts of data to build their images based on your prompts (in the AI world, a prompt is the instructions you give the AI), but they do have some drawbacks: They come with monthly fees, they keep a history of your interactions, and they may restrict what kinds of images you can request.

Local image generation running on your own Windows computer is free (aside from the electricity cost), and comes with no restrictions. You can experiment with any image prompt you can think of, and use community-made models to create unique content. It's a fun introduction to the emerging AI space, and can also help you develop other programming and IT skills.

How to Set Up Stable Diffusion Image Generation on Windows

Fooocus is an image generation program built using Stable Diffusion. It's 100% free and open-source, runs offline, and provides an out-of-the box AI image generator that "just works" — once you've got it up and running, you can just start prompting it with your ideas and get (almost) immediate results.

Most other Stable Diffusion and AI image generation tools for Windows are difficult to set up, with complex installation steps that often require familiarity with the underlying program. Fooocus is relatively simple to set up: all you need is a computer that supports Docker running via Windows Subsystem for Linux (WSL) and a modest GPU (Fooocus requires a 4GB NVIDIA graphics card to run).

It's worth noting that these steps also work on Linux. You can skip the WSL-specific steps below and just install Docker Desktop and use the Linux terminal instead of the Windows Terminal app. If you're a MacOS user, check out DiffusionBee, which provides similar, streamlined image generation with Stable Diffusion wrapped in its own app.

Step 1: Install Docker Desktop and Windows Terminal

Docker is software that lets you run 'containers', which are isolated environments that can hold all the dependencies and moving parts for a piece of software. They're a bit like a virtual machine, but have less overhead. To install Docker, download and install Docker Desktop for Windows.

Docker can run on Windows 10 and 11 in either WSL or Hyper-V mode. As Fooocus only supports WSL, you'll need to enable WSL first. You'll also need to install the Windows Terminal app before continuing.

Step 2: Download Fooocus

To download Fooocus, you'll need to visit their Github page and then click on the green "Code" button, followed by "Download ZIP". GitHub isn't the most user-friendly website (it's mostly used by developers to share code with each other), so the screenshot below shows where to find the button.

Want Powerful Local AI Image Generation on Windows? Use This Tool

Once the .zip file has finished downloading, extract it into its own folder, and open the folder containing the unzipped Fooocus files.

Step 3: Launch Fooocus

Next, right-click on an empty spot in the Fooocus directory, and click "Open in Terminal". This will open a Powershell terminal window.

Want Powerful Local AI Image Generation on Windows? Use This Tool

Make sure Docker Desktop is running, and then type the following docker command:

docker compose up -d

This command does the following:

  • Run the docker compose program, which is used to manage Docker applications
  • Starts the container by bringing it up
  • Tells the container to run in the background (-d for detached mode) Want Powerful Local AI Image Generation on Windows? Use This Tool

    If you haven't run Fooocus with Docker before, it will automatically build the Docker application based on the Fooocus code in the directory. This can take quite a while on some computers, so be patient and grab a coffee (or take a long lunch) while you wait.

    When it's done, you'll see that the Fooocus application has been created and started.

    Want Powerful Local AI Image Generation on Windows? Use This Tool

    You will also be able to see the Fooocus container running in Docker Desktop.

    Want Powerful Local AI Image Generation on Windows? Use This Tool

    From Docker Desktop, you can stop and start Fooocus (without having to use the terminal), or delete the container and all its data.

    Step 4: Generate Some Images!

    Now that Fooocus is up and running in Docker, you can access it from your web browser. By default, it runs on port 7865 and can be accessed at the address http://localhost:7865 ("localhost" is the address your computer uses to access itself). You can click on a running container in the Docker Desktop interface to see which ports on localhost can be used to access it.

    Once the Fooocus interface has loaded, it's simply a matter of asking it to make some images!

    Want Powerful Local AI Image Generation on Windows? Use This Tool

    The first image might take a bit longer than others while the models Fooocus uses are prepared. Here's an example of an image generated using a simple Fooocus prompt: a photo of a helpful How-To Geek surfing the net.

    Want Powerful Local AI Image Generation on Windows? Use This Tool

    If you want to tweak the behavior or try out different styles, or look at the history of images you've generated, click the "Advanced" checkbox. Fooocus comes with a lot of options, and you can even use community-built models from sites like CivitAI.

    There is some NSFW content on CivitAI.

    AI Is a Whole New Set of Tools for Fun, Learning, and Productivity!

    Generative AI can make text, images, and videos based on your requests. It's a whole new set of tools that you can use for fun, learning, and productivity. It's also a cool way to get started with programming, for example, by using Stable Diffusion with Python to generate images.

The above is the detailed content of Want Powerful Local AI Image Generation on Windows? Use This Tool. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn