SyncAI.news, a Varaisys broadcasting
Run ComfyUI workflows for free with Gradio on Hugging Face Spaces
HF

Hugging Face Blog

· 2 min read

AI LabsHugging Face Blog

Run ComfyUI workflows for free with Gradio on Hugging Face Spaces

Index:

  • Intro
    • Prerequisites
  • Exporting your ComfyUI workflow to run on pure Python
  • Create a Gradio app for your ComfyUI app
  • Prepare it to run on Hugging Face Spaces
  • Exporting to Spaces and running on ZeroGPU
  • Conclusion

Intro

In this tutorial I will present a step-by-step guide on how to convert a complex ComfyUI workflow to a simple Gradio application, and how to deploy this application on Hugging Face Spaces ZeroGPU serverless structure, which allows for it to be deployed and run for free in a serverless manner. In this tutorial, we are going to work with Nathan Shipley's Flux[dev] Redux + Flux[dev] Depth ComfyUI workflow, but you can follow the tutorial with any workflow that you would like.

The tl;dr summary of what we will cover in this tutorial is:

  1. Export your ComfyUI workflow using ComfyUI-to-Python-Extension;
  2. Create a Gradio app for the exported Python;
  3. Deploy it on Hugging Face Spaces with ZeroGPU;
  4. Soon: this entire process will be automated;

Prerequisites

  • Knowing how to run ComfyUI: this tutorial requires you to be able to grab a ComfyUI workflow and run it on your machine, installing missing nodes and finding the missing models (we do plan to automate this step soon though);
  • Getting the workflow you would like to export up and running (if you want to learn without a workflow in mind, feel free to get Nathan Shipley's Flux[dev] Redux + Flux[dev] Depth ComfyUI workflow up and running);
  • A little bit of coding knowledge: but I would encourage beginners to attempt to follow it, as it can be a really nice introduction to Python, Gradio and Spaces without too much prior programming knowledge needed.

(If you are looking for an end-to-end "workflow-to-app" structure, without needing to setup and run Comfy or knowing coding, stay tuned on my profile on Hugging Face or Twitter/X as we plan to do this in early 2025!).

1. Exporting your ComfyUI workflow to run on pure Python

2. Create a Gradio app for the exported Python

For that, a minimal Gradio app would be:

script:

Original source

This story was published by Hugging Face Blog. SyncAI.news shows a preview; the complete article is on the publisher's site.

Read the full story on huggingface.co

Similar News