How to Run Flux Image Generator with ComfyUI

How to Run Flux Image Generator with ComfyUI

What is Flux?

Flux is an innovative text-to-image AI model developed by Black Forest Labs that has quickly gained popularity among generative AI enthusiasts and digital artists. Its ability to generate high-quality images from simple text prompts sets it apart. The Flux 1 family includes three versions of their image generator models, each with its unique features:

  • Flux 1 Pro: Known for its superior image generation quality, Flux 1 Pro is accessible via APIs and excels in performance. While their pro version is not available for direct download, it provides the fastest and highest-quality output through their license.
  • Flux 1 Dev: This model is open-weight, allowing developers to freely explore and experiment with it. However, it is not designed for commercial purposes.
  • Flux 1 Schnell: The most user-friendly of the three, Flux 1 Schnell is open-source and can be found on platforms like Hugging Face. It's also the fastest model and only requires 4 steps to generate. It's perfect for personal projects and can be integrated with tools like Diffusers or Comfy UI.

Flux is a powerful AI tool for generating images, offering endless possibilities for creativity. Whether you’re a digital artist, content creator, or tech enthusiast, Flux provides a platform for artistic expression, realistic images and innovation in AI-driven image generation.

What Makes Flux Stand Out?

Flux 1 distinguishes itself from other text-to-image models with a blend of speed, quality, and adaptability. Here's what makes it unique:

  • Incredible Speed: Flux 1 is remarkably fast, capable of generating high-quality images in less than 2 seconds. This speed is transformative for creators who need quick results, such as those in video production or live streaming.
  • Hybrid Architecture: The Flux 1 models utilize a hybrid architecture that combines the strengths of transformers and diffusion models. This integration enables Flux to deliver exceptional image quality and processing speed, making it versatile for various creative projects.
  • Accurate Detail Rendering: A key feature of Flux is its ability to accurately render intricate details like fingers and text in images. This addresses common issues faced by other models, such as Stable Diffusion and DALL-E, using advanced transformer and diffusion techniques.

What is ComfyUI

ComfyUI is a popular graphical user interface (GUI) designed for creating and managing workflows in AI image generation. It allows users to construct image generation processes by connecting different modules, or nodes, in a flexible and intuitive way. This approach makes it easier for users to customize their workflows and explore different image generation techniques without needing to write complex code.

Although most popularly used to run Stable Diffusion, ComfyUI supports the integration of the FLUX image generation models.

If you'd like to try out Flux without ComfyUI and with Python code instead instead, check out our other blog on running the image generator using Jupyter notebook.

Try it for yourself

In this blog, we'll show you how you can get started with the Flux 1 Dev model and test out the AI image generator's visual quality with a sample text prompt in ComfyUI:

Prerequisites

  • Create your RunPod account (heads up, you'll need to load at least $10 into your RunPod account to get started).

Deploy Pod and Open ComfyUI

  1. Head to Pods and click Deploy.
  1. Select Your GPU Configuration: Choose the GPU that best fits your needs and budget. For the Schnell and Dev versions, they could run on a L40 or RTX 4090 easily. However, you can opt for a more affordable GPU with lesser VRAM if that suits your requirements. For detailed guidance on selecting the right VRAM for your model, check out our blog on picking the right VRAM.
  1. Click Change Template, search for "Flux.1-Dev-ComfyUI by Camenduru", and click it. This template was created by one of our community members!

4. Click the Deploy On-Demand button. It could take you up to 30 minutes to download the Flux models depending on your download speed! You can click Logs on your pod to track the download progress.

  1. Connect to Your Pod: Once deployed, navigate to the "Pods" section, locate your pod, and click "Connect."
  1. Click on Connect to HTTP Service [Port 7860] to open up ComfyUI

Running Flux 1 on Comfy UI

Once you've opened up ComfyUI, follow these detailed instructions to generate images on Flux 1. If you click on Connect to HTTP Service [Port 7860] and see an error message, wait a few minutes and try again.

  1. Download Flux workflow: Follow the link to this github file by Cammenduru (the community member who created this template) and click the download button to the top right of the code block to access Flux 1.

2. Import workflow into ComfyUI: Navigate back to your ComfyUI webpage and click on Load from the list of buttons on the bottom right and select the Flux.1-Dev-ComfyUI.json file we downloaded in step 1.

3. Edit your prompt: Look for the query prompt box and edit it to whatever you'd like.

  1. Run your model: Click Query Prompt to see your final high quality image like below! You can track the different modules and nodes in your workflow while it runs,.

Woohoo! You just ran Flux 1 Schnell.

Comment below with any problems you may be facing for support – We're here to help you every step of the way!

Conclusion

Black Forest Labs' Flux represents a transformative leap in AI image generation, offering a powerful tool for artists, developers, and creators alike. With its integration into ComfyUI, Flux opens up new possibilities for real-time content creation, high-definition visuals, and output diversity, enabling users to easily generate high-quality images through a flexible and intuitive interface. Whether you're using the open source Flux Schnell for personal use in local development or integrating Flux Pro through APIs for high-quality commercial applications, this innovative model family offers unparalleled flexibility and quality in AI image generation.

As Black Forest Labs continues to push the boundaries of AI technology, Flux stands as a testament to the potential of open-source AI-driven creativity, paving the way for future innovations in AI image generators. While many other ai image generators like Stable Diffusion are meant for non-commercial use, Flux Schnell can be used to generate high quality images for commercial purposes with its Apache license. If you're ready to explore the capabilities of Flux through ComfyUI, head over to RunPod and unleash the full potential of this cutting-edge model in your own projects.