Skip to content

In development. Expect rough edges and changes. The source code is not public yet.

Hugging Face 9 min read How-to mediumAdept

Rebuilding AUTOMATIC1111 with Gradio Workflow

Workflow1111 rebuilds most of AUTOMATIC1111's stable-diffusion-webui as a single Gradio Workflow canvas of eleven pipelines and 73 nodes, built from four operator kinds: Python fn, model via InferenceClient, Space calls and Hub datasets. Several A1111 features are reimagined. Hires fix and img2img become a FLUX.1-Kontext call, Interrogate uses Qwen2.5-VL plus a ViT classifier running in parallel, inpaint masks come from DETR detections, and the ControlNet annotators are plain NumPy functions running locally on CPU. Nodes at the same dependency depth run in parallel. Every output node becomes a REST endpoint and an MCP tool, and per-user OAuth tokens mean the Space holds no credentials of its own. The post also shows fn nodes running local GPU models via ZeroGPU and compares the approach with ComfyUI.

Assumes: Python basicsStable Diffusion workflowsHugging Face Hub

Related posts

  • Wire It, Run It, Deploy It: AI Workflows in Gradio

    Hugging Face mediumAdept

    Gradio's gr.Workflow turns AI pipelines into a graph of typed nodes (reference inputs, operator steps, subject outputs) served as a drag-and-drop canvas where every node is runnable and intermediate results are visible. Operators can be Python functions, Hugging Face Inference Providers models, other Gradio Spaces, or Hub dataset rows, and fan-out lets one input feed several operators in parallel. Each output automatically becomes a REST endpoint callable via gradio_client or curl, and fn nodes decorated with @spaces.GPU can run local models on ZeroGPU. Example Spaces include an image editor, a media studio chaining FLUX, background removal and TTS, and a dataset profiler.

  • Run ComfyUI workflows for free with Gradio on Hugging Face Spaces

    Hugging Face mediumAdept

    A ComfyUI node workflow can be turned into a standalone Gradio app and hosted for free on Hugging Face Spaces' serverless ZeroGPU tier. The steps: export the workflow to Python with ComfyUI-to-Python-Extension, then rewrite its main() into a generate_image function whose hard-coded node values become UI inputs and which returns the saved image path. To prepare for Spaces, fetch the models with hf_hub_download instead of uploading them, wrap inference in the @spaces.GPU decorator, and merge the custom nodes' dependencies into one requirements.txt. Loading models in global scope, outside the decorated function, keeps ZeroGPU from reloading them from disk on every run.

  • Introducing Daggr: Chain apps programmatically, inspect visually

    Hugging Face mediumAdept

    Daggr is an open-source Python library from the Gradio team for chaining Gradio Spaces, Hugging Face Inference Providers models and custom Python functions into workflows defined in code, with an automatically generated visual canvas. The canvas lets you inspect intermediate outputs, change inputs and rerun individual steps, while state, cached results and multiple "sheets" persist between sessions. Three node types are covered: GradioNode, which can clone and run a Space locally with remote fallback; FnNode; and InferenceNode. A walkthrough builds an image-to-3D pipeline from background removal, downscaling, FLUX.2-klein and TRELLIS.2. The library is in beta, so APIs may change and data loss is possible during updates.

  • Any Custom Frontend with Gradio's Backend

    Hugging Face mediumAdept

    gradio.Server extends FastAPI so any custom frontend (React, Svelte or plain HTML/JS) can sit on top of Gradio's backend, which provides queuing, concurrency control, SSE streaming, gradio_client compatibility and ZeroGPU support on Hugging Face Spaces. A Text Behind Image editor shows the pattern: about 50 lines of Python expose a BiRefNet background-removal endpoint via @app.api() and serve a ~1300-line vanilla HTML/JS app via a normal FastAPI route. The frontend calls the endpoint through the Gradio JS client rather than raw fetch, so requests go through the queue and concurrent GPU calls don't collide.

  • Implementing MCP Servers in Python: An AI Shopping Assistant with Gradio

    Hugging Face mediumAdept

    Gradio's MCP integration turns Python functions into LLM tools: launching an app with mcp_server=True exposes each endpoint as an MCP tool, with names, descriptions and input schemas generated from function docstrings, plus progress streaming and file upload handling. The walkthrough builds a virtual try-on shopping assistant by wrapping the IDM-VTON diffusion Space, called through the Gradio API client, in a Gradio Interface. That server is registered alongside the Playwright MCP server in VS Code's mcp.json, so the AI chat can browse a clothing store and render the user wearing selected garments.

The quest for software engineering knowledge.

Look:
Layout: