Tools

AI-generated text

Gradio's gr.Workflow turns AI pipelines into visual, deployable workflows

Gradio's new gr.Workflow embeds pipeline orchestration into the UI: users build typed graphs of nodes on a drag-and-drop canvas where every node can be run and intermediate results inspected.

Gradio's gr.Workflow turns AI pipelines into visual, deployable workflows

gr.Workflow, integrated directly into Gradio, treats the typical multi-step AI application — the pipeline — as the primary user interface. Instead of wiring steps together in Python and resorting to print-debugging when something goes wrong, gr.Workflow represents steps as typed graph nodes on a drag-and-drop canvas where every node can be executed and every intermediate result inspected.

What happens on the canvas

You build a graph of references (your inputs), operators (the steps that do work), and subjects (your outputs), connecting typed ports between them. An operator can be a Python function (an fn node), a model on Hugging Face Inference Providers, another Gradio Space, or a row from a Hub dataset. After wiring and pressing Run, results appear in place for each node.

Automatic REST endpoints and deployment

Every workflow automatically becomes an API: outputs are exposed as REST endpoints named after their labels (for example /sticker, /voiceover, /episode_title). You can call these endpoints from code using the Gradio client, and Spaces can be deployed to Hugging Face Spaces with a one-command workflow. Endpoints that call a model or a Space run under a Hugging Face token, so you provide a token when creating the client.

Live demos — examples you can open and duplicate

All featured apps are live Hugging Face Spaces you can run and copy.

  • Image Editor: Upload an image and request an edit (e.g. “turn it into a snowy winter scene”, “add sunglasses”, “make the car red”). The app is a single node calling Qwen-Image-Edit on Hugging Face Inference Providers and returns the edited image.

  • AI Media Studio: One canvas implements three pipelines from a single prompt: generate an image with FLUX, pass it to a background-removal Gradio Space to create a sticker; create a voiceover via a text-to-speech Gradio Space; and generate an episode title with an LLM. The workflow creates three outputs with separate REST endpoints (/sticker, /voiceover, /episode_title) that can be invoked directly from code.

  • Generative Art Lab: One idea produces a base image from FLUX, two re-imaginings (a soft watercolor version and a neon cyberpunk take), and a gallery title generated by an LLM. Each image node uses Inference Providers directly, while the title is produced by an fn node calling an LLM — an example of the fan-out pattern where one input feeds multiple operators in parallel.

  • Data Detective: Enter a Hugging Face dataset ID (for example stanfordnlp/imdb or mteb/tweet_sentiment_extraction) and a single input fans out to four operator nodes that analyze the dataset live via the Datasets Server API. You get an overview card, a preview of the first rows, per-column statistics, and a distribution chart, all computed independently and in parallel.

  • ZeroGPU Animator: fn nodes are just Python, so they can run models inside the Space on a GPU. Decorating the bound function with @spaces.GPU causes ZeroGPU to acquire a GPU for that call, run the model (for example Lightricks/LTX-Video via Diffusers), and release the GPU afterward. The demo animates a still image entirely within a single node; gr.Workflow does not need to know the GPU setup — it simply calls the bound function.

How the API looks from code

Every workflow is an API with no extra wiring: each output becomes a REST endpoint and can be called using the Gradio client. Endpoints that call models or Spaces require a Hugging Face token when creating the client. If you prefer, endpoints are also reachable over plain HTTP (e.g., curl). For a quick start you can duplicate any demo Space and begin rewiring, or bind functions with gr.Workflow(bind=[your_function]).launch() from Python.

Summary

gr.Workflow makes pipelines first-class: visually editable graphs where nodes are runnable and inspectable, automatic REST endpoints for each output, and one-command deployment to Hugging Face Spaces. Because operators can be Python functions, Inference Providers models, Gradio Spaces, or Hub dataset rows, gr.Workflow flexibly mixes local and remote resources for building interactive, debuggable AI apps.

Gradio also teases a forthcoming walkthrough showing how to build a more involved application (they mention AUTOMATIC1111 as an example) using gr.Workflow.