How to install and run Fooocus? (Google Colab/PC)

install fooocus on pc and colab

If you don't want to indulge in those coding and complicated WebUI interfaces or you want to get rid of some background node types web interface for Stable Diffusion, then FOOOCUS can be a good alternative for you. Installing and running FOOOCUS is so easy that anybody can easily use it. 

A simple slick design web interface gives you a burden-free image generation experience like Midjourney. FOOOCUS is a hot new AI art tool based on Gradio (like we have Automatic1111) that makes creating images as easy as writing text prompts. 

To run this WebUI on a PC, you need a minimum 4GB VRAM (GPU Memory) by NVIDIA  and 8GB system memory, and for running into Google Colab you should have a Google account. 

In this tutorial, we’ll walk through getting started with FOOOCUS from scratch in simple steps. But if you want to master Fooocus then we have made detailed tutorial where we explained its each aspects. You should defiantly check that out.


Why to use FOOOCUS? :

-Secured personal environment for experimentation

-No reliance on cloud services, but yes you can run on cloud as well.

-Intuitive prompt-based image generation

-Predefined styles for quick art direction

-Automated optimizations for high quality.

-No complicated connecting nodes like ComfyUI.


Install on PC (Windows/ Mac/ Linux):

install python for fooocus on pc

1. First make sure you have the latest version of python installed.

Enable Add to path option

Now while downloading make sure to enable the check box of the "Add to path" option. If you are a Mac user then you need to first download Home brew to set up the python environment.

git download for fooocus

git installation

2. Second, download and install GIT by following the next steps. For Windows / Mac and Linux choose the appropriate link for downloading GIT.

download fooocus from browser

3. Now, you need to download FOOOCUS. For that just copy and paste the following link provided below into your browser:

https://github.com/lllyasviel/Fooocus/releases/download/release/Fooocus_win64_2-1-831.7z

This file size is 1 GB. So, be patient while it's getting downloaded.

zip extractor

fooocus file extraction with 7zip

4. Unzip the entire downloaded folder (Download 7ZIP  zip extractor and use it to extract the downloaded zipped folder) and place it somewhere convenient on your PC to access. Here, we have used 7ZIP to extract the downloaded zipped folder.

click on run.bat file to launch

5. Double-click the "Run.bat" file inside the FOOOCUS folder. This will kick things off. On the first run, FOOOCUS will automatically download the extra AI models it needs in the background. Be patient as this can take a couple of minutes.

Once loaded, you will see the FOOOCUS interface with an empty prompt box, ready for your instructions.

6. Prompts are text descriptions that tell FOOOCUS what type of image you want to create. Now, let's try something simple at first, like:

fooocus webui on google colab

beautiful woman, red long dress, standing near lamp post, nightlights, ultra realistic, 8k


Go ahead and pop that prompt into the text box.

7. With your prompt entered, go ahead and click the "Generate" button. Give FOOOCUS a moment to work its AI magic.

On the right, you will start seeing new images appearing based on your prompt. FOOOCUS defaults to generating 4 images at a time.

8. Let's try refining the image quality using some of FOOOCUS's options. 

Click the "Settings" gear icon to open advanced settings. Under "Performance" choose "Quality" instead of "Regular".

Back on the main window, hit Generate again with the same prompt. The AI should now render higher fidelity images based on the setting change.

Have a play with other options like aspect ratio and image count as well to see how they impact the art FOOOCUS creates.

9. We can guide FOOOCUS further by using an existing image as a starting point. 

Simply drag and drop any picture you want onto the canvas area. Then choose "Vary" options to transform that input image while keeping aspects intact.

This gives the AI a base to build on, like changing the clothing of a person while keeping their face consistent. Feel free to get creative with your image prompts.



Install and Run on Google Colab:

First of all, we will tell you that there are multiple versions of FOOOCUS to run on Google Colab which we have enlisted for you:
 
1. Fooocus Colab (Official Version)- This is the official version released by its developer itself.
2. Fooocus-MRE Colab (Modified version)
4. SDXL_fooocus_colab - This is the old version with Stable Diffusion XL base 1.0 model.
5. Juggernaut-xl_fooocus_colab (This will run with Juggernaut-xl model)

You can choose any of the Fooocus versions as your requirement, but here we are choosing the first one.

Steps:

google colab


1. Open your Google Colab by going to the link provided below:

Open in Fooocus directly on GoogleColab


google colab set runtime type

2. Check your runtime setting and set it to T4 GPU by selecting on "Runtime" tab presented over to menu and then selecting the "change runtime type" option.


google colab set runtime type

3. A new dialog box will appear. Just select T4 GPU and last click Save. Now move to the top right section of the dashboard. 

Connect to Colab GPU

A Connect button will be available. To connect to the GPU, you need to click on it. Just click it.


google colab click to execute

4. Now, Click on the play button to start executing the code.  Wait for all the libraries and prerequisites to get installed. Please be patient.  In our case, it took around 7-8 minutes.


google colab click to open

5. On next, you will see a web address starting from "https://....". Just click on the link to open FOOOCUS WebUI.


fooocus webui on google colab

6. A new window will open with a text box in it which is the FOOOCUS WebUI.

7. Now, we  generated the image using this prompt:
beautiful woman, red long dress, standing near lamp post, nightlights, ultra realistic, 8k


fooocus ui google colab time

And here is the output. It took almost ~74 seconds to generate a pair of images. 

image generated using Fooocus webui

image generated using Fooocus webui

The result is quite good and just look at the lighting effect from the background adds a naturalness to the picture.


Extra tips:

check google colab memory

1. Multiple Disconnect: If you are running on the Google Colab free version then you need to keep in mind that a fixed GPU, RAM, and Disk have been provided, so while generating images, you must check regularly that your application is running out of RAM/GPU memory or not otherwise you will face disconnects.

If you face some error then the solution is to destroy the session by restarting the Google Colab and start the process from the beginning. 

To check the status, you need to click on the status like graph which will be available at the top right corner of the dashboard like you are seeing on the above image.

Cannot connect to GPU backend

If you are facing error while running Fooocus using your free Colab account like  "Cannot connect to GPU backend", then it means you have exhausted the limited resources provided by Google Colab. The quick solution is to switch to Colab Pro plan or you can use our trick how to run Stable Diffusion on Google Colab in free plan(No disconnects).

2. GPU Error: You often encountered an error like NVIDIA error while installing Fooocus,  this means that you didn't select the T4 GPU provided by Google Colab. Its to inform you that users get the limited resources for GPU and sometimes it provides you NVIDIA. To check what GPU you have been provided, run this command in new cell:

!nvidia-smi

Its to take into consideration that larger GPUs always not be available and preferences will be given as per your requirement and their system management. So, use these features wisely.


Conclusion:

And that's it - you now know the basics of unleashing this AI artist with simple text prompts. There are many more advanced features in FOOOCUS to explore, but start simple using the steps above.

It's one of the ways to generate images on PC and Google Colab where you don't need to stuck around WeBUI like Automatic1111 which has multiple options that increase confusion.