{
  "@context": "https://schema.org",
  "@id": "https://aggr.aymericbeaumet.com/items/huggingface-co/2026-09-10-rebuilding-automatic1111-with-gradio-workflow/#webpage",
  "@type": [
    "WebPage",
    "ArchiveComponent"
  ],
  "articleBody": "In our [last post](https://huggingface.co/blog/gradio-workflow-guide), we built five small `gr.Workflow` graphs and hinted at what it would take to build something as complex as AUTOMATIC1111's [stable-diffusion-webui](https://github.com/AUTOMATIC1111/stable-diffusion-webui). In this post we walk you through **Workflow1111**, where we have rebuilt most of AUTOMATIC1111's feature set as a single workflow canvas.\n\nWorkflow1111 is a graph of **eleven media pipelines** built using **seventy-three nodes**. It brings together SOTA models for text-to-image, hi-resolution fix, image-to-image, prompt-matrix grids, VLM interrogate, detection-to-inpaint masks, ControlNet-style annotators, background removal, PNG Info storing, and image-to-video.\n\nYou can run any of these pipelines by signing in with your Hugging Face account or providing an access token. Once you sign in, the model calls use your own quota.\n\n👉 **[Try Workflow1111](https://huggingface.co/spaces/ysharma/Workflow1111)**, or duplicate the Space and start rewiring it for your own use case.\n\nLet's walk the canvas.\n\n## What's on the canvas\n\nAll the media pipelines are built from the same four operator kinds covered in our last post and the [official guide](https://gradio.app/guides/workflows#operator-kinds). Each node on the canvas wraps one operator, and the operator's inputs and outputs become the ports you connect edges to. As a quick reference on our four operator kinds: `fn` is a Python function, `model` is a model called through `InferenceClient`, `space` is another Gradio Space, and `dataset` is a row from a Hub dataset.\n\nLet's go through the pipelines one by one.\n\n### Text-to-image\n\nThis is the core pipeline. It has the controls you'd expect from A1111's txt2img tab: negative prompt, steps, CFG, seed, width and height, plus a `model_id` field for choosing the checkpoint. The prompt goes through a prompt-builder `fn` node first, which appends the selected style preset and cleans up the text, then into a `model` node that calls the checkpoint through Inference Providers. A post-process `fn` node writes the generation parameters into the PNG's metadata on the way out, which is what the PNG Info pipeline reads back later.\n\n### Hi-resolution fix\n\nIn Automatic1111, hi-resolution fix first upscales the txt2img output and then runs a second denoising pass. Here it's a two-node detour instead. The text-to-image result goes into a [FLUX.1-Kontext](https://huggingface.co/black-forest-labs/FLUX.1-Kontext-dev) `model` node with a refine instruction (\"enhance fine detail and micro-texture, keep the composition identical\") and comes back sharper and larger.\n\n### Image-to-image\n\nThat same Kontext node doubles as the image-to-image tab. Upload an image, describe the change you want, and it returns the edited image.\n\n### Let an LLM write the prompt\n\nStart with a rough prompt like \"A lighthouse in a storm.\" This pipeline sends it to a [Qwen3-4B](https://huggingface.co/Qwen/Qwen3-4B-Instruct-2507) `model` node, and a small `fn` node turns the reply into a clean list of tags, capped at forty: \"stormy sea, wet rocks, dramatic composition, low angle shot, volumetric lighting, ominous tone.\" You can connect any diffusion model node to this output to render the image.\n\nThere's no custom node involved, unlike in ComfyUI. In a Gradio workflow the LLM and the diffusion model are both ordinary `model` operators on the same canvas.\n\n### Read an image back into a prompt\n\nThis is like AUTOMATIC1111's Interrogate button, with a VLM doing the interrogating instead of CLIP. [Qwen2.5-VL](https://huggingface.co/Qwen/Qwen2.5-VL-7B-Instruct) looks at a night-market photo and writes a prompt that could have produced it. A [ViT](https://huggingface.co/google/vit-base-patch16-224) classifier node reads the same image and returns labels: restaurant 51.9%, tobacco shop 15.6%, toyshop 9.1%.\n\nBoth nodes use the same image input, so `gr.Workflow` runs them in parallel and you get both answers in roughly the time it takes to run one.\n\n### Detection to inpaint mask\n\nAUTOMATIC1111 makes you paint an inpaint mask by hand. This pipeline generates one from a detector instead. [DETR](https://huggingface.co/facebook/detr-resnet-50) finds six objects in a street photo (three people, a dog, a bicycle, and a car), and from there the workflow splits into two branches: one draws the detected boxes on the original image, the other turns them into a mask you can feed into an inpaint pipeline downstream.\n\nThe drawing and the mask creation both happen locally with Pillow and NumPy. Only the detection call leaves the machine.\n\n### Prompt matrix\n\nThis is like AUTOMATIC1111's prompt matrix. A base prompt, \"a lone oak tree,\" gets combined with four suffixes (at sunrise, in a thunderstorm, under the Milky Way, in autumn fog) by a `fn` node, and each variant goes to its own text-to-image node. A final node stitches the four results into one contact sheet.\n\n`gr.Workflow` has no loop operator, so the four text-to-image nodes sit side by side on the canvas. Since they're at the same dependency depth they run in parallel, and all four images start generating at once.\n\n### Upscale and background removal\n\nThis is like the Extras tab in Automatic1111. There are two upscaler nodes, and they take different routes. The first is a local [Lanczos](https://en.wikipedia.org/wiki/Lanczos_resampling) resample in an `fn` node, which needs no network call and finishes as fast as Pillow can resize. The second is [AuraSR ×4](https://huggingface.co/spaces/gokaygokay/AuraSR-v2), and it's the first `space` node on the canvas: it calls a [Space](https://huggingface.co/spaces/gokaygokay/AuraSR-v2) on the Hub and treats the result like any other node output.\n\nBackground removal works the same way. [BRIA RMBG-2.0](https://huggingface.co/spaces/briaai/BRIA-RMBG-2.0) is another `space` node, so the whole model lives in its own Space and this canvas just calls it in.\n\n### Annotators\n\nCanny, line art, sketch, luma-depth, and posterize are the preprocessors you'd normally get from the ControlNet extension in Automatic1111. Here, each one is a `fn` node written in plain NumPy, with no model behind it. On a pre-loaded example photo of a building facade, each annotator takes about half a second on CPU.\n\nThere are 36 operator nodes in the app, 32 are `fn` nodes, and 22 of those run entirely in-process without a network call. Roughly two-thirds of the canvas keeps working if you lose your connection. Since these are regular Python functions, you can also test them directly, with no canvas, server, or GPU involved.\n\n### PNG Info\n\nAUTOMATIC1111 stores generation details in the PNG's `parameters` text chunk, and the PNG Info tab reads them back. Workflow1111 does the same. The post-process node on the text-to-image pipeline writes the metadata, and this pipeline reads it back out, including the prompt, negative prompt, steps, CFG, seed, image size, and model.\n\n### Image-to-video\n\nThe image node that PNG Info reads from also feeds a [Wan 2.2 I2V A14B](https://huggingface.co/Wan-AI/Wan2.2-I2V-A14B) node, which animates it; in the demo example a sleeping fox wakes up and starts moving. There's no second upload box because one reference node can feed as many downstream pipelines as you need, so a single upload gets its metadata read and gets animated on the same canvas.\n\n## Running models on your own GPU\n\nSo far every model call has gone to someone else's hardware, through Inference Providers or a Space. That's why you can build and run something like Workflow1111 without a GPU of your own.\n\nA `fn` node is just Python, though, so it can equally load a model locally and run it on your own GPU. [FastVideo/fastvideo-fasth3-preview](https://huggingface.co/spaces/FastVideo/fastvideo-fasth3-preview) is a `gr.Workflow` app that does exactly that. It runs [FastH3](https://huggingface.co/FastVideo/FastVideo-FastH3-4-step-Preview-v1-VSA-DataFree), a four-step distillation of [MiniMax-H3](https://huggingface.co/MiniMaxAI/MiniMax-H3), and generates video with a soundtrack on ZeroGPU.\n\nThe whole app comes down to one bound function:\n\n```python\n@spaces.GPU(duration=get_duration, size=GPU_SIZE)\ndef _generate(prompt_embeds, text_token_tags, height, width, num_frames, seed):\n    ...\n\ngr.Workflow(bind={\"generate\": generate, \"status\": status}).launch()\n```\n\n[ZeroGPU](https://huggingface.co/docs/hub/spaces-zerogpu) gives the function a GPU when it needs one, then releases it when the call is done. `gr.Workflow` doesn't need to know about any of that. It just calls the `fn` node.\n\nThis isn't specific to Spaces either. Point `bind=` to a function that loads a local checkpoint, run `.launch()` on your own machine, and the Workflow1111 canvas can drive your own GPU.\n\n## Every output is an API\n\nEvery output node on the canvas becomes a REST endpoint, with no routes written by hand. Workflow1111 exposes nine of them: `/image`, `/edited_image`, `/generated_prompt`, `/recovered_prompt`, `/detected_objects`, `/x_y_grid`, `/upscaled_local`, `/annotator_map`, and `/png_info`.\n\n```python\nfrom gradio_client import Client\n\nclient = Client(\"ysharma/Workflow1111\", oauth_token=\"hf_...\")\n\nimage, params, hires = client.predict(\n    \"a red fox in a snowy pine forest\",  # Prompt\n    \"\",                                  # Negative prompt\n    \"Cinematic\",                         # Style preset\n    \"enhance fine detail\",               # Hires refine instruction\n    api_name=\"/image\",\n)\n```\n\nThe same endpoints are also [MCP](https://modelcontextprotocol.io) tools. Launch with `mcp_server=True` ([guide](https://www.gradio.app/guides/building-mcp-server-with-gradio)) and every output node shows up as a tool an AI assistant can call. Point Claude Code, Cursor, or any MCP client at the server URL:\n\n```json\n{\n  \"mcpServers\": {\n    \"workflow1111\": {\n      \"url\": \"https://ysharma-workflow1111.hf.space/gradio_api/mcp/\",\n      \"headers\": { \"X-HF-Token\": \"hf_...\" }\n    }\n  }\n}\n```\n\nNow an agent can generate an image, read a prompt back out, or run detection as steps in a larger task, with no glue code. Each caller sends their own token in the `X-HF-Token` header, so the Space holds none of its own.\n\n## Where this sits next to ComfyUI\n\nAUTOMATIC1111 gave us the feature list, but the tool Gradio Workflow really gets compared to is ComfyUI, since both are node graphs. For a lot of what people want to build and ship, `gr.Workflow` covers the same ground.\n\n- **A node can be hardware you don't own.** It can run through [Inference Providers](https://huggingface.co/docs/inference-providers/index), call any Space on the Hub or any API, or pull from a dataset. That's how Workflow1111 runs without a GPU of its own.\n- **Every output becomes a typed REST endpoint.** The endpoints are generated from the graph.\n- **Visitors can run workflows under their own identity.** Turn on [OAuth](https://huggingface.co/docs/hub/spaces-oauth), share the public URL, and anyone can sign in and use the app without installing anything.\n- **Mix models and modalities on the same canvas.** Diffusion models, LLMs, VLMs, detectors, and video models can all be part of the same workflow.\n- **Need something custom? Write a function.** A custom node is a Python function, so it can do whatever Python can.\n\nThe result is a multi-model pipeline that people can open in a browser, sign into, use right away, and call from code.\n\n## Build your own\n\nWorkflow1111 has 73 nodes, but it started with just this:\n\n```python\nimport gradio as gr\n\ndef your_function(text: str) -> str:\n    pass\n\ngr.Workflow(bind=[your_function]).launch()\n```\n\n`bind=` turns your functions into nodes, `edges=` connects them, and `.launch()` opens the canvas in your browser so you can keep editing there. When it's ready, `gradio deploy` puts the whole thing on a Space. The [gr.Workflow guide](https://gradio.app/guides/workflows) has the full details, including the JSON schema and every operator type.\n\nIf you'd rather start from something that already works, open [Workflow1111](https://huggingface.co/spaces/ysharma/Workflow1111), hit **Duplicate**, and pick one of the eleven pipelines to change: delete nodes, swap models, rewire the flow. If you'd rather start smaller, the [previous post](https://huggingface.co/blog/gradio-workflow-guide) has five workflows you can get running in about a minute each.\n\nWhatever you build, post it on X and tag [@gradio](https://x.com/Gradio). We'd be happy to amplify your workflows.\n",
  "authors": [],
  "captured_at": "2026-10-19T01:26:53.998049939+00:00",
  "category": "ai",
  "content_html": "<p>In our <a target=\"_blank\" rel=\"noopener noreferrer\" href=\"https://huggingface.co/blog/gradio-workflow-guide\">last post</a>, we built five small <code>gr.Workflow</code> graphs and hinted at what it would take to build something as complex as AUTOMATIC1111's <a target=\"_blank\" rel=\"noopener noreferrer\" href=\"https://github.com/AUTOMATIC1111/stable-diffusion-webui\">stable-diffusion-webui</a>. In this post we walk you through <strong>Workflow1111</strong>, where we have rebuilt most of AUTOMATIC1111's feature set as a single workflow canvas.</p>\n<p>Workflow1111 is a graph of <strong>eleven media pipelines</strong> built using <strong>seventy-three nodes</strong>. It brings together SOTA models for text-to-image, hi-resolution fix, image-to-image, prompt-matrix grids, VLM interrogate, detection-to-inpaint masks, ControlNet-style annotators, background removal, PNG Info storing, and image-to-video.</p>\n<p>You can run any of these pipelines by signing in with your Hugging Face account or providing an access token. Once you sign in, the model calls use your own quota.</p>\n<p>👉 <strong><a target=\"_blank\" rel=\"noopener noreferrer\" href=\"https://huggingface.co/spaces/ysharma/Workflow1111\">Try Workflow1111</a></strong>, or duplicate the Space and start rewiring it for your own use case.</p>\n<p>Let's walk the canvas.</p>\n<h2>What's on the canvas</h2>\n<p>All the media pipelines are built from the same four operator kinds covered in our last post and the <a target=\"_blank\" rel=\"noopener noreferrer\" href=\"https://gradio.app/guides/workflows#operator-kinds\">official guide</a>. Each node on the canvas wraps one operator, and the operator's inputs and outputs become the ports you connect edges to. As a quick reference on our four operator kinds: <code>fn</code> is a Python function, <code>model</code> is a model called through <code>InferenceClient</code>, <code>space</code> is another Gradio Space, and <code>dataset</code> is a row from a Hub dataset.</p>\n<p>Let's go through the pipelines one by one.</p>\n<h3>Text-to-image</h3>\n<p>This is the core pipeline. It has the controls you'd expect from A1111's txt2img tab: negative prompt, steps, CFG, seed, width and height, plus a <code>model_id</code> field for choosing the checkpoint. The prompt goes through a prompt-builder <code>fn</code> node first, which appends the selected style preset and cleans up the text, then into a <code>model</code> node that calls the checkpoint through Inference Providers. A post-process <code>fn</code> node writes the generation parameters into the PNG's metadata on the way out, which is what the PNG Info pipeline reads back later.</p>\n<h3>Hi-resolution fix</h3>\n<p>In Automatic1111, hi-resolution fix first upscales the txt2img output and then runs a second denoising pass. Here it's a two-node detour instead. The text-to-image result goes into a <a target=\"_blank\" rel=\"noopener noreferrer\" href=\"https://huggingface.co/black-forest-labs/FLUX.1-Kontext-dev\">FLUX.1-Kontext</a> <code>model</code> node with a refine instruction (&quot;enhance fine detail and micro-texture, keep the composition identical&quot;) and comes back sharper and larger.</p>\n<h3>Image-to-image</h3>\n<p>That same Kontext node doubles as the image-to-image tab. Upload an image, describe the change you want, and it returns the edited image.</p>\n<h3>Let an LLM write the prompt</h3>\n<p>Start with a rough prompt like &quot;A lighthouse in a storm.&quot; This pipeline sends it to a <a target=\"_blank\" rel=\"noopener noreferrer\" href=\"https://huggingface.co/Qwen/Qwen3-4B-Instruct-2507\">Qwen3-4B</a> <code>model</code> node, and a small <code>fn</code> node turns the reply into a clean list of tags, capped at forty: &quot;stormy sea, wet rocks, dramatic composition, low angle shot, volumetric lighting, ominous tone.&quot; You can connect any diffusion model node to this output to render the image.</p>\n<p>There's no custom node involved, unlike in ComfyUI. In a Gradio workflow the LLM and the diffusion model are both ordinary <code>model</code> operators on the same canvas.</p>\n<h3>Read an image back into a prompt</h3>\n<p>This is like AUTOMATIC1111's Interrogate button, with a VLM doing the interrogating instead of CLIP. <a target=\"_blank\" rel=\"noopener noreferrer\" href=\"https://huggingface.co/Qwen/Qwen2.5-VL-7B-Instruct\">Qwen2.5-VL</a> looks at a night-market photo and writes a prompt that could have produced it. A <a target=\"_blank\" rel=\"noopener noreferrer\" href=\"https://huggingface.co/google/vit-base-patch16-224\">ViT</a> classifier node reads the same image and returns labels: restaurant 51.9%, tobacco shop 15.6%, toyshop 9.1%.</p>\n<p>Both nodes use the same image input, so <code>gr.Workflow</code> runs them in parallel and you get both answers in roughly the time it takes to run one.</p>\n<h3>Detection to inpaint mask</h3>\n<p>AUTOMATIC1111 makes you paint an inpaint mask by hand. This pipeline generates one from a detector instead. <a target=\"_blank\" rel=\"noopener noreferrer\" href=\"https://huggingface.co/facebook/detr-resnet-50\">DETR</a> finds six objects in a street photo (three people, a dog, a bicycle, and a car), and from there the workflow splits into two branches: one draws the detected boxes on the original image, the other turns them into a mask you can feed into an inpaint pipeline downstream.</p>\n<p>The drawing and the mask creation both happen locally with Pillow and NumPy. Only the detection call leaves the machine.</p>\n<h3>Prompt matrix</h3>\n<p>This is like AUTOMATIC1111's prompt matrix. A base prompt, &quot;a lone oak tree,&quot; gets combined with four suffixes (at sunrise, in a thunderstorm, under the Milky Way, in autumn fog) by a <code>fn</code> node, and each variant goes to its own text-to-image node. A final node stitches the four results into one contact sheet.</p>\n<p><code>gr.Workflow</code> has no loop operator, so the four text-to-image nodes sit side by side on the canvas. Since they're at the same dependency depth they run in parallel, and all four images start generating at once.</p>\n<h3>Upscale and background removal</h3>\n<p>This is like the Extras tab in Automatic1111. There are two upscaler nodes, and they take different routes. The first is a local <a target=\"_blank\" rel=\"noopener noreferrer\" href=\"https://en.wikipedia.org/wiki/Lanczos_resampling\">Lanczos</a> resample in an <code>fn</code> node, which needs no network call and finishes as fast as Pillow can resize. The second is <a target=\"_blank\" rel=\"noopener noreferrer\" href=\"https://huggingface.co/spaces/gokaygokay/AuraSR-v2\">AuraSR ×4</a>, and it's the first <code>space</code> node on the canvas: it calls a <a target=\"_blank\" rel=\"noopener noreferrer\" href=\"https://huggingface.co/spaces/gokaygokay/AuraSR-v2\">Space</a> on the Hub and treats the result like any other node output.</p>\n<p>Background removal works the same way. <a target=\"_blank\" rel=\"noopener noreferrer\" href=\"https://huggingface.co/spaces/briaai/BRIA-RMBG-2.0\">BRIA RMBG-2.0</a> is another <code>space</code> node, so the whole model lives in its own Space and this canvas just calls it in.</p>\n<h3>Annotators</h3>\n<p>Canny, line art, sketch, luma-depth, and posterize are the preprocessors you'd normally get from the ControlNet extension in Automatic1111. Here, each one is a <code>fn</code> node written in plain NumPy, with no model behind it. On a pre-loaded example photo of a building facade, each annotator takes about half a second on CPU.</p>\n<p>There are 36 operator nodes in the app, 32 are <code>fn</code> nodes, and 22 of those run entirely in-process without a network call. Roughly two-thirds of the canvas keeps working if you lose your connection. Since these are regular Python functions, you can also test them directly, with no canvas, server, or GPU involved.</p>\n<h3>PNG Info</h3>\n<p>AUTOMATIC1111 stores generation details in the PNG's <code>parameters</code> text chunk, and the PNG Info tab reads them back. Workflow1111 does the same. The post-process node on the text-to-image pipeline writes the metadata, and this pipeline reads it back out, including the prompt, negative prompt, steps, CFG, seed, image size, and model.</p>\n<h3>Image-to-video</h3>\n<p>The image node that PNG Info reads from also feeds a <a target=\"_blank\" rel=\"noopener noreferrer\" href=\"https://huggingface.co/Wan-AI/Wan2.2-I2V-A14B\">Wan 2.2 I2V A14B</a> node, which animates it; in the demo example a sleeping fox wakes up and starts moving. There's no second upload box because one reference node can feed as many downstream pipelines as you need, so a single upload gets its metadata read and gets animated on the same canvas.</p>\n<h2>Running models on your own GPU</h2>\n<p>So far every model call has gone to someone else's hardware, through Inference Providers or a Space. That's why you can build and run something like Workflow1111 without a GPU of your own.</p>\n<p>A <code>fn</code> node is just Python, though, so it can equally load a model locally and run it on your own GPU. <a target=\"_blank\" rel=\"noopener noreferrer\" href=\"https://huggingface.co/spaces/FastVideo/fastvideo-fasth3-preview\">FastVideo/fastvideo-fasth3-preview</a> is a <code>gr.Workflow</code> app that does exactly that. It runs <a target=\"_blank\" rel=\"noopener noreferrer\" href=\"https://huggingface.co/FastVideo/FastVideo-FastH3-4-step-Preview-v1-VSA-DataFree\">FastH3</a>, a four-step distillation of <a target=\"_blank\" rel=\"noopener noreferrer\" href=\"https://huggingface.co/MiniMaxAI/MiniMax-H3\">MiniMax-H3</a>, and generates video with a soundtrack on ZeroGPU.</p>\n<p>The whole app comes down to one bound function:</p>\n<pre><code class=\"language-python\"><span class=\"code-snippet\" data-language=\"Python\"><span class=\"syntax-source syntax-python\"><span class=\"syntax-meta syntax-annotation syntax-python\"><span class=\"syntax-punctuation syntax-definition syntax-annotation syntax-python\">@</span><span class=\"syntax-meta syntax-annotation syntax-function syntax-python\"></span></span><span class=\"syntax-meta syntax-annotation syntax-function syntax-python\"><span class=\"syntax-meta syntax-qualified-name syntax-python\"><span class=\"syntax-meta syntax-generic-name syntax-python\">spaces</span><span class=\"syntax-punctuation syntax-accessor syntax-dot syntax-python\">.</span></span><span class=\"syntax-meta syntax-qualified-name syntax-python\"><span class=\"syntax-variable syntax-annotation syntax-function syntax-python\">GPU</span></span><span class=\"syntax-punctuation syntax-section syntax-arguments syntax-begin syntax-python\">(</span><span class=\"syntax-meta syntax-annotation syntax-arguments syntax-python\"><span class=\"syntax-variable syntax-parameter syntax-python\">duration</span><span class=\"syntax-keyword syntax-operator syntax-assignment syntax-python\">=</span><span class=\"syntax-meta syntax-qualified-name syntax-python\"><span class=\"syntax-meta syntax-generic-name syntax-python\">get_duration</span></span><span class=\"syntax-punctuation syntax-separator syntax-arguments syntax-python\">,</span> <span class=\"syntax-variable syntax-parameter syntax-python\">size</span><span class=\"syntax-keyword syntax-operator syntax-assignment syntax-python\">=</span><span class=\"syntax-meta syntax-qualified-name syntax-python\"><span class=\"syntax-variable syntax-other syntax-constant syntax-python\">GPU_SIZE</span></span></span><span class=\"syntax-punctuation syntax-section syntax-arguments syntax-end syntax-python\">)</span></span>\n<span class=\"syntax-meta syntax-function syntax-python\"><span class=\"syntax-storage syntax-type syntax-function syntax-python\">def</span> <span class=\"syntax-entity syntax-name syntax-function syntax-python\"><span class=\"syntax-meta syntax-generic-name syntax-python\">_generate</span></span></span><span class=\"syntax-meta syntax-function syntax-parameters syntax-python\"><span class=\"syntax-punctuation syntax-section syntax-parameters syntax-begin syntax-python\">(</span></span><span class=\"syntax-meta syntax-function syntax-parameters syntax-python\"><span class=\"syntax-variable syntax-parameter syntax-python\">prompt_embeds</span><span class=\"syntax-punctuation syntax-separator syntax-parameters syntax-python\">,</span> <span class=\"syntax-variable syntax-parameter syntax-python\">text_token_tags</span><span class=\"syntax-punctuation syntax-separator syntax-parameters syntax-python\">,</span> <span class=\"syntax-variable syntax-parameter syntax-python\">height</span><span class=\"syntax-punctuation syntax-separator syntax-parameters syntax-python\">,</span> <span class=\"syntax-variable syntax-parameter syntax-python\">width</span><span class=\"syntax-punctuation syntax-separator syntax-parameters syntax-python\">,</span> <span class=\"syntax-variable syntax-parameter syntax-python\">num_frames</span><span class=\"syntax-punctuation syntax-separator syntax-parameters syntax-python\">,</span> <span class=\"syntax-variable syntax-parameter syntax-python\">seed</span><span class=\"syntax-punctuation syntax-section syntax-parameters syntax-end syntax-python\">)</span></span><span class=\"syntax-meta syntax-function syntax-python\"><span class=\"syntax-punctuation syntax-section syntax-function syntax-begin syntax-python\">:</span></span>\n    <span class=\"syntax-constant syntax-language syntax-python\">...</span>\n\n<span class=\"syntax-meta syntax-function-call syntax-python\"><span class=\"syntax-meta syntax-qualified-name syntax-python\"><span class=\"syntax-meta syntax-generic-name syntax-python\">gr</span><span class=\"syntax-punctuation syntax-accessor syntax-dot syntax-python\">.</span></span><span class=\"syntax-meta syntax-qualified-name syntax-python\"><span class=\"syntax-variable syntax-function syntax-python\">Workflow</span></span><span class=\"syntax-punctuation syntax-section syntax-arguments syntax-begin syntax-python\">(</span><span class=\"syntax-meta syntax-function-call syntax-arguments syntax-python\"><span class=\"syntax-variable syntax-parameter syntax-python\">bind</span><span class=\"syntax-keyword syntax-operator syntax-assignment syntax-python\">=</span><span class=\"syntax-meta syntax-structure syntax-dictionary-or-set syntax-python\"><span class=\"syntax-punctuation syntax-section syntax-dictionary-or-set syntax-begin syntax-python\">{</span><span class=\"syntax-meta syntax-string syntax-python\"><span class=\"syntax-string syntax-quoted syntax-double syntax-python\"><span class=\"syntax-punctuation syntax-definition syntax-string syntax-begin syntax-python\">&quot;</span></span></span><span class=\"syntax-meta syntax-string syntax-python\"><span class=\"syntax-string syntax-quoted syntax-double syntax-python\">generate<span class=\"syntax-punctuation syntax-definition syntax-string syntax-end syntax-python\">&quot;</span></span></span><span class=\"syntax-punctuation syntax-separator syntax-key-value syntax-python\">:</span> <span class=\"syntax-meta syntax-qualified-name syntax-python\"><span class=\"syntax-meta syntax-generic-name syntax-python\">generate</span></span><span class=\"syntax-punctuation syntax-separator syntax-dictionary-or-set syntax-python\">,</span> <span class=\"syntax-meta syntax-string syntax-python\"><span class=\"syntax-string syntax-quoted syntax-double syntax-python\"><span class=\"syntax-punctuation syntax-definition syntax-string syntax-begin syntax-python\">&quot;</span></span></span><span class=\"syntax-meta syntax-string syntax-python\"><span class=\"syntax-string syntax-quoted syntax-double syntax-python\">status<span class=\"syntax-punctuation syntax-definition syntax-string syntax-end syntax-python\">&quot;</span></span></span><span class=\"syntax-punctuation syntax-separator syntax-key-value syntax-python\">:</span> <span class=\"syntax-meta syntax-qualified-name syntax-python\"><span class=\"syntax-meta syntax-generic-name syntax-python\">status</span></span><span class=\"syntax-punctuation syntax-section syntax-dictionary-or-set syntax-end syntax-python\">}</span></span></span><span class=\"syntax-punctuation syntax-section syntax-arguments syntax-end syntax-python\">)</span></span><span class=\"syntax-meta syntax-function-call syntax-python\"><span class=\"syntax-meta syntax-qualified-name syntax-python\"><span class=\"syntax-punctuation syntax-accessor syntax-dot syntax-python\">.</span></span><span class=\"syntax-meta syntax-qualified-name syntax-python\"><span class=\"syntax-variable syntax-function syntax-python\">launch</span></span><span class=\"syntax-punctuation syntax-section syntax-arguments syntax-begin syntax-python\">(</span><span class=\"syntax-punctuation syntax-section syntax-arguments syntax-end syntax-python\">)</span></span>\n</span></span></code></pre>\n<p><a target=\"_blank\" rel=\"noopener noreferrer\" href=\"https://huggingface.co/docs/hub/spaces-zerogpu\">ZeroGPU</a> gives the function a GPU when it needs one, then releases it when the call is done. <code>gr.Workflow</code> doesn't need to know about any of that. It just calls the <code>fn</code> node.</p>\n<p>This isn't specific to Spaces either. Point <code>bind=</code> to a function that loads a local checkpoint, run <code>.launch()</code> on your own machine, and the Workflow1111 canvas can drive your own GPU.</p>\n<h2>Every output is an API</h2>\n<p>Every output node on the canvas becomes a REST endpoint, with no routes written by hand. Workflow1111 exposes nine of them: <code>/image</code>, <code>/edited_image</code>, <code>/generated_prompt</code>, <code>/recovered_prompt</code>, <code>/detected_objects</code>, <code>/x_y_grid</code>, <code>/upscaled_local</code>, <code>/annotator_map</code>, and <code>/png_info</code>.</p>\n<pre><code class=\"language-python\"><span class=\"code-snippet\" data-language=\"Python\"><span class=\"syntax-source syntax-python\"><span class=\"syntax-meta syntax-statement syntax-import syntax-python\"><span class=\"syntax-keyword syntax-control syntax-import syntax-from syntax-python\">from</span></span><span class=\"syntax-meta syntax-statement syntax-import syntax-python\"><span class=\"syntax-meta syntax-import-source syntax-python\"> <span class=\"syntax-meta syntax-import-path syntax-python\"><span class=\"syntax-meta syntax-import-name syntax-python\">gradio_client</span></span> <span class=\"syntax-meta syntax-statement syntax-import syntax-python\"><span class=\"syntax-keyword syntax-control syntax-import syntax-python\">import</span></span></span></span><span class=\"syntax-meta syntax-statement syntax-import syntax-python\"></span><span class=\"syntax-meta syntax-statement syntax-import syntax-python\"> <span class=\"syntax-meta syntax-generic-name syntax-python\">Client</span></span>\n\n<span class=\"syntax-meta syntax-qualified-name syntax-python\"><span class=\"syntax-meta syntax-generic-name syntax-python\">client</span></span> <span class=\"syntax-keyword syntax-operator syntax-assignment syntax-python\">=</span> <span class=\"syntax-meta syntax-function-call syntax-python\"><span class=\"syntax-meta syntax-qualified-name syntax-python\"><span class=\"syntax-variable syntax-function syntax-python\">Client</span></span><span class=\"syntax-punctuation syntax-section syntax-arguments syntax-begin syntax-python\">(</span><span class=\"syntax-meta syntax-function-call syntax-arguments syntax-python\"><span class=\"syntax-meta syntax-string syntax-python\"><span class=\"syntax-string syntax-quoted syntax-double syntax-python\"><span class=\"syntax-punctuation syntax-definition syntax-string syntax-begin syntax-python\">&quot;</span></span></span><span class=\"syntax-meta syntax-string syntax-python\"><span class=\"syntax-string syntax-quoted syntax-double syntax-python\">ysharma/Workflow1111<span class=\"syntax-punctuation syntax-definition syntax-string syntax-end syntax-python\">&quot;</span></span></span><span class=\"syntax-punctuation syntax-separator syntax-arguments syntax-python\">,</span> <span class=\"syntax-variable syntax-parameter syntax-python\">oauth_token</span><span class=\"syntax-keyword syntax-operator syntax-assignment syntax-python\">=</span><span class=\"syntax-meta syntax-string syntax-python\"><span class=\"syntax-string syntax-quoted syntax-double syntax-python\"><span class=\"syntax-punctuation syntax-definition syntax-string syntax-begin syntax-python\">&quot;</span></span></span><span class=\"syntax-meta syntax-string syntax-python\"><span class=\"syntax-string syntax-quoted syntax-double syntax-python\">hf_...<span class=\"syntax-punctuation syntax-definition syntax-string syntax-end syntax-python\">&quot;</span></span></span></span><span class=\"syntax-punctuation syntax-section syntax-arguments syntax-end syntax-python\">)</span></span>\n\n<span class=\"syntax-meta syntax-qualified-name syntax-python\"><span class=\"syntax-meta syntax-generic-name syntax-python\">image</span></span>, <span class=\"syntax-meta syntax-qualified-name syntax-python\"><span class=\"syntax-meta syntax-generic-name syntax-python\">params</span></span>, <span class=\"syntax-meta syntax-qualified-name syntax-python\"><span class=\"syntax-meta syntax-generic-name syntax-python\">hires</span></span> <span class=\"syntax-keyword syntax-operator syntax-assignment syntax-python\">=</span> <span class=\"syntax-meta syntax-function-call syntax-python\"><span class=\"syntax-meta syntax-qualified-name syntax-python\"><span class=\"syntax-meta syntax-generic-name syntax-python\">client</span><span class=\"syntax-punctuation syntax-accessor syntax-dot syntax-python\">.</span></span><span class=\"syntax-meta syntax-qualified-name syntax-python\"><span class=\"syntax-variable syntax-function syntax-python\">predict</span></span><span class=\"syntax-punctuation syntax-section syntax-arguments syntax-begin syntax-python\">(</span><span class=\"syntax-meta syntax-function-call syntax-arguments syntax-python\">\n    <span class=\"syntax-meta syntax-string syntax-python\"><span class=\"syntax-string syntax-quoted syntax-double syntax-python\"><span class=\"syntax-punctuation syntax-definition syntax-string syntax-begin syntax-python\">&quot;</span></span></span><span class=\"syntax-meta syntax-string syntax-python\"><span class=\"syntax-string syntax-quoted syntax-double syntax-python\">a red fox in a snowy pine forest<span class=\"syntax-punctuation syntax-definition syntax-string syntax-end syntax-python\">&quot;</span></span></span><span class=\"syntax-punctuation syntax-separator syntax-arguments syntax-python\">,</span>  <span class=\"syntax-comment syntax-line syntax-number-sign syntax-python\"><span class=\"syntax-punctuation syntax-definition syntax-comment syntax-python\">#</span> Prompt\n</span>    <span class=\"syntax-meta syntax-string syntax-python\"><span class=\"syntax-string syntax-quoted syntax-double syntax-python\"><span class=\"syntax-punctuation syntax-definition syntax-string syntax-begin syntax-python\">&quot;</span></span></span><span class=\"syntax-meta syntax-string syntax-python\"><span class=\"syntax-string syntax-quoted syntax-double syntax-python\"><span class=\"syntax-punctuation syntax-definition syntax-string syntax-end syntax-python\">&quot;</span></span></span><span class=\"syntax-punctuation syntax-separator syntax-arguments syntax-python\">,</span>                                  <span class=\"syntax-comment syntax-line syntax-number-sign syntax-python\"><span class=\"syntax-punctuation syntax-definition syntax-comment syntax-python\">#</span> Negative prompt\n</span>    <span class=\"syntax-meta syntax-string syntax-python\"><span class=\"syntax-string syntax-quoted syntax-double syntax-python\"><span class=\"syntax-punctuation syntax-definition syntax-string syntax-begin syntax-python\">&quot;</span></span></span><span class=\"syntax-meta syntax-string syntax-python\"><span class=\"syntax-string syntax-quoted syntax-double syntax-python\">Cinematic<span class=\"syntax-punctuation syntax-definition syntax-string syntax-end syntax-python\">&quot;</span></span></span><span class=\"syntax-punctuation syntax-separator syntax-arguments syntax-python\">,</span>                         <span class=\"syntax-comment syntax-line syntax-number-sign syntax-python\"><span class=\"syntax-punctuation syntax-definition syntax-comment syntax-python\">#</span> Style preset\n</span>    <span class=\"syntax-meta syntax-string syntax-python\"><span class=\"syntax-string syntax-quoted syntax-double syntax-python\"><span class=\"syntax-punctuation syntax-definition syntax-string syntax-begin syntax-python\">&quot;</span></span></span><span class=\"syntax-meta syntax-string syntax-python\"><span class=\"syntax-string syntax-quoted syntax-double syntax-python\">enhance fine detail<span class=\"syntax-punctuation syntax-definition syntax-string syntax-end syntax-python\">&quot;</span></span></span><span class=\"syntax-punctuation syntax-separator syntax-arguments syntax-python\">,</span>               <span class=\"syntax-comment syntax-line syntax-number-sign syntax-python\"><span class=\"syntax-punctuation syntax-definition syntax-comment syntax-python\">#</span> Hires refine instruction\n</span>    <span class=\"syntax-variable syntax-parameter syntax-python\">api_name</span><span class=\"syntax-keyword syntax-operator syntax-assignment syntax-python\">=</span><span class=\"syntax-meta syntax-string syntax-python\"><span class=\"syntax-string syntax-quoted syntax-double syntax-python\"><span class=\"syntax-punctuation syntax-definition syntax-string syntax-begin syntax-python\">&quot;</span></span></span><span class=\"syntax-meta syntax-string syntax-python\"><span class=\"syntax-string syntax-quoted syntax-double syntax-python\">/image<span class=\"syntax-punctuation syntax-definition syntax-string syntax-end syntax-python\">&quot;</span></span></span><span class=\"syntax-punctuation syntax-separator syntax-arguments syntax-python\">,</span>\n</span><span class=\"syntax-punctuation syntax-section syntax-arguments syntax-end syntax-python\">)</span></span>\n</span></span></code></pre>\n<p>The same endpoints are also <a target=\"_blank\" rel=\"noopener noreferrer\" href=\"https://modelcontextprotocol.io\">MCP</a> tools. Launch with <code>mcp_server=True</code> (<a target=\"_blank\" rel=\"noopener noreferrer\" href=\"https://www.gradio.app/guides/building-mcp-server-with-gradio\">guide</a>) and every output node shows up as a tool an AI assistant can call. Point Claude Code, Cursor, or any MCP client at the server URL:</p>\n<pre><code class=\"language-json\"><span class=\"code-snippet\" data-language=\"JSON\"><span class=\"syntax-source syntax-json\"><span class=\"syntax-meta syntax-structure syntax-dictionary syntax-json\"><span class=\"syntax-punctuation syntax-section syntax-dictionary syntax-begin syntax-json\">{</span>\n  <span class=\"syntax-meta syntax-structure syntax-dictionary syntax-key syntax-json\"><span class=\"syntax-string syntax-quoted syntax-double syntax-json\"><span class=\"syntax-punctuation syntax-definition syntax-string syntax-begin syntax-json\">&quot;</span>mcpServers<span class=\"syntax-punctuation syntax-definition syntax-string syntax-end syntax-json\">&quot;</span></span></span><span class=\"syntax-meta syntax-structure syntax-dictionary syntax-value syntax-json\"><span class=\"syntax-punctuation syntax-separator syntax-dictionary syntax-key-value syntax-json\">:</span> <span class=\"syntax-meta syntax-structure syntax-dictionary syntax-json\"><span class=\"syntax-punctuation syntax-section syntax-dictionary syntax-begin syntax-json\">{</span>\n    <span class=\"syntax-meta syntax-structure syntax-dictionary syntax-key syntax-json\"><span class=\"syntax-string syntax-quoted syntax-double syntax-json\"><span class=\"syntax-punctuation syntax-definition syntax-string syntax-begin syntax-json\">&quot;</span>workflow1111<span class=\"syntax-punctuation syntax-definition syntax-string syntax-end syntax-json\">&quot;</span></span></span><span class=\"syntax-meta syntax-structure syntax-dictionary syntax-value syntax-json\"><span class=\"syntax-punctuation syntax-separator syntax-dictionary syntax-key-value syntax-json\">:</span> <span class=\"syntax-meta syntax-structure syntax-dictionary syntax-json\"><span class=\"syntax-punctuation syntax-section syntax-dictionary syntax-begin syntax-json\">{</span>\n      <span class=\"syntax-meta syntax-structure syntax-dictionary syntax-key syntax-json\"><span class=\"syntax-string syntax-quoted syntax-double syntax-json\"><span class=\"syntax-punctuation syntax-definition syntax-string syntax-begin syntax-json\">&quot;</span>url<span class=\"syntax-punctuation syntax-definition syntax-string syntax-end syntax-json\">&quot;</span></span></span><span class=\"syntax-meta syntax-structure syntax-dictionary syntax-value syntax-json\"><span class=\"syntax-punctuation syntax-separator syntax-dictionary syntax-key-value syntax-json\">:</span> <span class=\"syntax-string syntax-quoted syntax-double syntax-json\"><span class=\"syntax-punctuation syntax-definition syntax-string syntax-begin syntax-json\">&quot;</span>https://ysharma-workflow1111.hf.space/gradio_api/mcp/<span class=\"syntax-punctuation syntax-definition syntax-string syntax-end syntax-json\">&quot;</span></span><span class=\"syntax-punctuation syntax-separator syntax-dictionary syntax-pair syntax-json\">,</span></span>\n      <span class=\"syntax-meta syntax-structure syntax-dictionary syntax-key syntax-json\"><span class=\"syntax-string syntax-quoted syntax-double syntax-json\"><span class=\"syntax-punctuation syntax-definition syntax-string syntax-begin syntax-json\">&quot;</span>headers<span class=\"syntax-punctuation syntax-definition syntax-string syntax-end syntax-json\">&quot;</span></span></span><span class=\"syntax-meta syntax-structure syntax-dictionary syntax-value syntax-json\"><span class=\"syntax-punctuation syntax-separator syntax-dictionary syntax-key-value syntax-json\">:</span> <span class=\"syntax-meta syntax-structure syntax-dictionary syntax-json\"><span class=\"syntax-punctuation syntax-section syntax-dictionary syntax-begin syntax-json\">{</span> <span class=\"syntax-meta syntax-structure syntax-dictionary syntax-key syntax-json\"><span class=\"syntax-string syntax-quoted syntax-double syntax-json\"><span class=\"syntax-punctuation syntax-definition syntax-string syntax-begin syntax-json\">&quot;</span>X-HF-Token<span class=\"syntax-punctuation syntax-definition syntax-string syntax-end syntax-json\">&quot;</span></span></span><span class=\"syntax-meta syntax-structure syntax-dictionary syntax-value syntax-json\"><span class=\"syntax-punctuation syntax-separator syntax-dictionary syntax-key-value syntax-json\">:</span> <span class=\"syntax-string syntax-quoted syntax-double syntax-json\"><span class=\"syntax-punctuation syntax-definition syntax-string syntax-begin syntax-json\">&quot;</span>hf_...<span class=\"syntax-punctuation syntax-definition syntax-string syntax-end syntax-json\">&quot;</span></span> </span><span class=\"syntax-punctuation syntax-section syntax-dictionary syntax-end syntax-json\">}</span></span>\n    </span><span class=\"syntax-punctuation syntax-section syntax-dictionary syntax-end syntax-json\">}</span></span>\n  </span><span class=\"syntax-punctuation syntax-section syntax-dictionary syntax-end syntax-json\">}</span></span>\n</span><span class=\"syntax-punctuation syntax-section syntax-dictionary syntax-end syntax-json\">}</span></span>\n</span></span></code></pre>\n<p>Now an agent can generate an image, read a prompt back out, or run detection as steps in a larger task, with no glue code. Each caller sends their own token in the <code>X-HF-Token</code> header, so the Space holds none of its own.</p>\n<h2>Where this sits next to ComfyUI</h2>\n<p>AUTOMATIC1111 gave us the feature list, but the tool Gradio Workflow really gets compared to is ComfyUI, since both are node graphs. For a lot of what people want to build and ship, <code>gr.Workflow</code> covers the same ground.</p>\n<ul>\n<li><strong>A node can be hardware you don't own.</strong> It can run through <a target=\"_blank\" rel=\"noopener noreferrer\" href=\"https://huggingface.co/docs/inference-providers/index\">Inference Providers</a>, call any Space on the Hub or any API, or pull from a dataset. That's how Workflow1111 runs without a GPU of its own.</li>\n<li><strong>Every output becomes a typed REST endpoint.</strong> The endpoints are generated from the graph.</li>\n<li><strong>Visitors can run workflows under their own identity.</strong> Turn on <a target=\"_blank\" rel=\"noopener noreferrer\" href=\"https://huggingface.co/docs/hub/spaces-oauth\">OAuth</a>, share the public URL, and anyone can sign in and use the app without installing anything.</li>\n<li><strong>Mix models and modalities on the same canvas.</strong> Diffusion models, LLMs, VLMs, detectors, and video models can all be part of the same workflow.</li>\n<li><strong>Need something custom? Write a function.</strong> A custom node is a Python function, so it can do whatever Python can.</li>\n</ul>\n<p>The result is a multi-model pipeline that people can open in a browser, sign into, use right away, and call from code.</p>\n<h2>Build your own</h2>\n<p>Workflow1111 has 73 nodes, but it started with just this:</p>\n<pre><code class=\"language-python\"><span class=\"code-snippet\" data-language=\"Python\"><span class=\"syntax-source syntax-python\"><span class=\"syntax-meta syntax-statement syntax-import syntax-python\"><span class=\"syntax-keyword syntax-control syntax-import syntax-python\">import</span> <span class=\"syntax-meta syntax-qualified-name syntax-python\"><span class=\"syntax-meta syntax-generic-name syntax-python\">gradio</span></span> <span class=\"syntax-keyword syntax-control syntax-import syntax-as syntax-python\">as</span> <span class=\"syntax-meta syntax-qualified-name syntax-python\"><span class=\"syntax-meta syntax-generic-name syntax-python\">gr</span></span></span>\n\n<span class=\"syntax-meta syntax-function syntax-python\"><span class=\"syntax-storage syntax-type syntax-function syntax-python\">def</span> <span class=\"syntax-entity syntax-name syntax-function syntax-python\"><span class=\"syntax-meta syntax-generic-name syntax-python\">your_function</span></span></span><span class=\"syntax-meta syntax-function syntax-parameters syntax-python\"><span class=\"syntax-punctuation syntax-section syntax-parameters syntax-begin syntax-python\">(</span></span><span class=\"syntax-meta syntax-function syntax-parameters syntax-python\"><span class=\"syntax-variable syntax-parameter syntax-python\">text</span></span><span class=\"syntax-meta syntax-function syntax-parameters syntax-annotation syntax-python\"><span class=\"syntax-punctuation syntax-separator syntax-annotation syntax-parameter syntax-python\">:</span> <span class=\"syntax-meta syntax-qualified-name syntax-python\"><span class=\"syntax-support syntax-type syntax-python\">str</span></span></span><span class=\"syntax-meta syntax-function syntax-parameters syntax-python\"><span class=\"syntax-punctuation syntax-section syntax-parameters syntax-end syntax-python\">)</span></span><span class=\"syntax-meta syntax-function syntax-python\"> </span><span class=\"syntax-meta syntax-function syntax-annotation syntax-return syntax-python\"><span class=\"syntax-punctuation syntax-separator syntax-annotation syntax-return syntax-python\">-&gt;</span> <span class=\"syntax-meta syntax-qualified-name syntax-python\"><span class=\"syntax-support syntax-type syntax-python\">str</span></span></span><span class=\"syntax-meta syntax-function syntax-python\"><span class=\"syntax-punctuation syntax-section syntax-function syntax-begin syntax-python\">:</span></span>\n    <span class=\"syntax-keyword syntax-control syntax-flow syntax-python\">pass</span>\n\n<span class=\"syntax-meta syntax-function-call syntax-python\"><span class=\"syntax-meta syntax-qualified-name syntax-python\"><span class=\"syntax-meta syntax-generic-name syntax-python\">gr</span><span class=\"syntax-punctuation syntax-accessor syntax-dot syntax-python\">.</span></span><span class=\"syntax-meta syntax-qualified-name syntax-python\"><span class=\"syntax-variable syntax-function syntax-python\">Workflow</span></span><span class=\"syntax-punctuation syntax-section syntax-arguments syntax-begin syntax-python\">(</span><span class=\"syntax-meta syntax-function-call syntax-arguments syntax-python\"><span class=\"syntax-variable syntax-parameter syntax-python\">bind</span><span class=\"syntax-keyword syntax-operator syntax-assignment syntax-python\">=</span><span class=\"syntax-meta syntax-structure syntax-list syntax-python\"><span class=\"syntax-punctuation syntax-section syntax-list syntax-begin syntax-python\">[</span><span class=\"syntax-meta syntax-qualified-name syntax-python\"><span class=\"syntax-meta syntax-generic-name syntax-python\">your_function</span></span><span class=\"syntax-punctuation syntax-section syntax-list syntax-end syntax-python\">]</span></span></span><span class=\"syntax-punctuation syntax-section syntax-arguments syntax-end syntax-python\">)</span></span><span class=\"syntax-meta syntax-function-call syntax-python\"><span class=\"syntax-meta syntax-qualified-name syntax-python\"><span class=\"syntax-punctuation syntax-accessor syntax-dot syntax-python\">.</span></span><span class=\"syntax-meta syntax-qualified-name syntax-python\"><span class=\"syntax-variable syntax-function syntax-python\">launch</span></span><span class=\"syntax-punctuation syntax-section syntax-arguments syntax-begin syntax-python\">(</span><span class=\"syntax-punctuation syntax-section syntax-arguments syntax-end syntax-python\">)</span></span>\n</span></span></code></pre>\n<p><code>bind=</code> turns your functions into nodes, <code>edges=</code> connects them, and <code>.launch()</code> opens the canvas in your browser so you can keep editing there. When it's ready, <code>gradio deploy</code> puts the whole thing on a Space. The <a target=\"_blank\" rel=\"noopener noreferrer\" href=\"https://gradio.app/guides/workflows\">gr.Workflow guide</a> has the full details, including the JSON schema and every operator type.</p>\n<p>If you'd rather start from something that already works, open <a target=\"_blank\" rel=\"noopener noreferrer\" href=\"https://huggingface.co/spaces/ysharma/Workflow1111\">Workflow1111</a>, hit <strong>Duplicate</strong>, and pick one of the eleven pipelines to change: delete nodes, swap models, rewire the flow. If you'd rather start smaller, the <a target=\"_blank\" rel=\"noopener noreferrer\" href=\"https://huggingface.co/blog/gradio-workflow-guide\">previous post</a> has five workflows you can get running in about a minute each.</p>\n<p>Whatever you build, post it on X and tag <a target=\"_blank\" rel=\"noopener noreferrer\" href=\"https://x.com/Gradio\">@gradio</a>. We'd be happy to amplify your workflows.</p>\n",
  "content_markdown": "In our [last post](https://huggingface.co/blog/gradio-workflow-guide), we built five small `gr.Workflow` graphs and hinted at what it would take to build something as complex as AUTOMATIC1111's [stable-diffusion-webui](https://github.com/AUTOMATIC1111/stable-diffusion-webui). In this post we walk you through **Workflow1111**, where we have rebuilt most of AUTOMATIC1111's feature set as a single workflow canvas.\n\nWorkflow1111 is a graph of **eleven media pipelines** built using **seventy-three nodes**. It brings together SOTA models for text-to-image, hi-resolution fix, image-to-image, prompt-matrix grids, VLM interrogate, detection-to-inpaint masks, ControlNet-style annotators, background removal, PNG Info storing, and image-to-video.\n\nYou can run any of these pipelines by signing in with your Hugging Face account or providing an access token. Once you sign in, the model calls use your own quota.\n\n👉 **[Try Workflow1111](https://huggingface.co/spaces/ysharma/Workflow1111)**, or duplicate the Space and start rewiring it for your own use case.\n\nLet's walk the canvas.\n\n## What's on the canvas\n\nAll the media pipelines are built from the same four operator kinds covered in our last post and the [official guide](https://gradio.app/guides/workflows#operator-kinds). Each node on the canvas wraps one operator, and the operator's inputs and outputs become the ports you connect edges to. As a quick reference on our four operator kinds: `fn` is a Python function, `model` is a model called through `InferenceClient`, `space` is another Gradio Space, and `dataset` is a row from a Hub dataset.\n\nLet's go through the pipelines one by one.\n\n### Text-to-image\n\nThis is the core pipeline. It has the controls you'd expect from A1111's txt2img tab: negative prompt, steps, CFG, seed, width and height, plus a `model_id` field for choosing the checkpoint. The prompt goes through a prompt-builder `fn` node first, which appends the selected style preset and cleans up the text, then into a `model` node that calls the checkpoint through Inference Providers. A post-process `fn` node writes the generation parameters into the PNG's metadata on the way out, which is what the PNG Info pipeline reads back later.\n\n### Hi-resolution fix\n\nIn Automatic1111, hi-resolution fix first upscales the txt2img output and then runs a second denoising pass. Here it's a two-node detour instead. The text-to-image result goes into a [FLUX.1-Kontext](https://huggingface.co/black-forest-labs/FLUX.1-Kontext-dev) `model` node with a refine instruction (\"enhance fine detail and micro-texture, keep the composition identical\") and comes back sharper and larger.\n\n### Image-to-image\n\nThat same Kontext node doubles as the image-to-image tab. Upload an image, describe the change you want, and it returns the edited image.\n\n### Let an LLM write the prompt\n\nStart with a rough prompt like \"A lighthouse in a storm.\" This pipeline sends it to a [Qwen3-4B](https://huggingface.co/Qwen/Qwen3-4B-Instruct-2507) `model` node, and a small `fn` node turns the reply into a clean list of tags, capped at forty: \"stormy sea, wet rocks, dramatic composition, low angle shot, volumetric lighting, ominous tone.\" You can connect any diffusion model node to this output to render the image.\n\nThere's no custom node involved, unlike in ComfyUI. In a Gradio workflow the LLM and the diffusion model are both ordinary `model` operators on the same canvas.\n\n### Read an image back into a prompt\n\nThis is like AUTOMATIC1111's Interrogate button, with a VLM doing the interrogating instead of CLIP. [Qwen2.5-VL](https://huggingface.co/Qwen/Qwen2.5-VL-7B-Instruct) looks at a night-market photo and writes a prompt that could have produced it. A [ViT](https://huggingface.co/google/vit-base-patch16-224) classifier node reads the same image and returns labels: restaurant 51.9%, tobacco shop 15.6%, toyshop 9.1%.\n\nBoth nodes use the same image input, so `gr.Workflow` runs them in parallel and you get both answers in roughly the time it takes to run one.\n\n### Detection to inpaint mask\n\nAUTOMATIC1111 makes you paint an inpaint mask by hand. This pipeline generates one from a detector instead. [DETR](https://huggingface.co/facebook/detr-resnet-50) finds six objects in a street photo (three people, a dog, a bicycle, and a car), and from there the workflow splits into two branches: one draws the detected boxes on the original image, the other turns them into a mask you can feed into an inpaint pipeline downstream.\n\nThe drawing and the mask creation both happen locally with Pillow and NumPy. Only the detection call leaves the machine.\n\n### Prompt matrix\n\nThis is like AUTOMATIC1111's prompt matrix. A base prompt, \"a lone oak tree,\" gets combined with four suffixes (at sunrise, in a thunderstorm, under the Milky Way, in autumn fog) by a `fn` node, and each variant goes to its own text-to-image node. A final node stitches the four results into one contact sheet.\n\n`gr.Workflow` has no loop operator, so the four text-to-image nodes sit side by side on the canvas. Since they're at the same dependency depth they run in parallel, and all four images start generating at once.\n\n### Upscale and background removal\n\nThis is like the Extras tab in Automatic1111. There are two upscaler nodes, and they take different routes. The first is a local [Lanczos](https://en.wikipedia.org/wiki/Lanczos_resampling) resample in an `fn` node, which needs no network call and finishes as fast as Pillow can resize. The second is [AuraSR ×4](https://huggingface.co/spaces/gokaygokay/AuraSR-v2), and it's the first `space` node on the canvas: it calls a [Space](https://huggingface.co/spaces/gokaygokay/AuraSR-v2) on the Hub and treats the result like any other node output.\n\nBackground removal works the same way. [BRIA RMBG-2.0](https://huggingface.co/spaces/briaai/BRIA-RMBG-2.0) is another `space` node, so the whole model lives in its own Space and this canvas just calls it in.\n\n### Annotators\n\nCanny, line art, sketch, luma-depth, and posterize are the preprocessors you'd normally get from the ControlNet extension in Automatic1111. Here, each one is a `fn` node written in plain NumPy, with no model behind it. On a pre-loaded example photo of a building facade, each annotator takes about half a second on CPU.\n\nThere are 36 operator nodes in the app, 32 are `fn` nodes, and 22 of those run entirely in-process without a network call. Roughly two-thirds of the canvas keeps working if you lose your connection. Since these are regular Python functions, you can also test them directly, with no canvas, server, or GPU involved.\n\n### PNG Info\n\nAUTOMATIC1111 stores generation details in the PNG's `parameters` text chunk, and the PNG Info tab reads them back. Workflow1111 does the same. The post-process node on the text-to-image pipeline writes the metadata, and this pipeline reads it back out, including the prompt, negative prompt, steps, CFG, seed, image size, and model.\n\n### Image-to-video\n\nThe image node that PNG Info reads from also feeds a [Wan 2.2 I2V A14B](https://huggingface.co/Wan-AI/Wan2.2-I2V-A14B) node, which animates it; in the demo example a sleeping fox wakes up and starts moving. There's no second upload box because one reference node can feed as many downstream pipelines as you need, so a single upload gets its metadata read and gets animated on the same canvas.\n\n## Running models on your own GPU\n\nSo far every model call has gone to someone else's hardware, through Inference Providers or a Space. That's why you can build and run something like Workflow1111 without a GPU of your own.\n\nA `fn` node is just Python, though, so it can equally load a model locally and run it on your own GPU. [FastVideo/fastvideo-fasth3-preview](https://huggingface.co/spaces/FastVideo/fastvideo-fasth3-preview) is a `gr.Workflow` app that does exactly that. It runs [FastH3](https://huggingface.co/FastVideo/FastVideo-FastH3-4-step-Preview-v1-VSA-DataFree), a four-step distillation of [MiniMax-H3](https://huggingface.co/MiniMaxAI/MiniMax-H3), and generates video with a soundtrack on ZeroGPU.\n\nThe whole app comes down to one bound function:\n\n```python\n@spaces.GPU(duration=get_duration, size=GPU_SIZE)\ndef _generate(prompt_embeds, text_token_tags, height, width, num_frames, seed):\n    ...\n\ngr.Workflow(bind={\"generate\": generate, \"status\": status}).launch()\n```\n\n[ZeroGPU](https://huggingface.co/docs/hub/spaces-zerogpu) gives the function a GPU when it needs one, then releases it when the call is done. `gr.Workflow` doesn't need to know about any of that. It just calls the `fn` node.\n\nThis isn't specific to Spaces either. Point `bind=` to a function that loads a local checkpoint, run `.launch()` on your own machine, and the Workflow1111 canvas can drive your own GPU.\n\n## Every output is an API\n\nEvery output node on the canvas becomes a REST endpoint, with no routes written by hand. Workflow1111 exposes nine of them: `/image`, `/edited_image`, `/generated_prompt`, `/recovered_prompt`, `/detected_objects`, `/x_y_grid`, `/upscaled_local`, `/annotator_map`, and `/png_info`.\n\n```python\nfrom gradio_client import Client\n\nclient = Client(\"ysharma/Workflow1111\", oauth_token=\"hf_...\")\n\nimage, params, hires = client.predict(\n    \"a red fox in a snowy pine forest\",  # Prompt\n    \"\",                                  # Negative prompt\n    \"Cinematic\",                         # Style preset\n    \"enhance fine detail\",               # Hires refine instruction\n    api_name=\"/image\",\n)\n```\n\nThe same endpoints are also [MCP](https://modelcontextprotocol.io) tools. Launch with `mcp_server=True` ([guide](https://www.gradio.app/guides/building-mcp-server-with-gradio)) and every output node shows up as a tool an AI assistant can call. Point Claude Code, Cursor, or any MCP client at the server URL:\n\n```json\n{\n  \"mcpServers\": {\n    \"workflow1111\": {\n      \"url\": \"https://ysharma-workflow1111.hf.space/gradio_api/mcp/\",\n      \"headers\": { \"X-HF-Token\": \"hf_...\" }\n    }\n  }\n}\n```\n\nNow an agent can generate an image, read a prompt back out, or run detection as steps in a larger task, with no glue code. Each caller sends their own token in the `X-HF-Token` header, so the Space holds none of its own.\n\n## Where this sits next to ComfyUI\n\nAUTOMATIC1111 gave us the feature list, but the tool Gradio Workflow really gets compared to is ComfyUI, since both are node graphs. For a lot of what people want to build and ship, `gr.Workflow` covers the same ground.\n\n- **A node can be hardware you don't own.** It can run through [Inference Providers](https://huggingface.co/docs/inference-providers/index), call any Space on the Hub or any API, or pull from a dataset. That's how Workflow1111 runs without a GPU of its own.\n- **Every output becomes a typed REST endpoint.** The endpoints are generated from the graph.\n- **Visitors can run workflows under their own identity.** Turn on [OAuth](https://huggingface.co/docs/hub/spaces-oauth), share the public URL, and anyone can sign in and use the app without installing anything.\n- **Mix models and modalities on the same canvas.** Diffusion models, LLMs, VLMs, detectors, and video models can all be part of the same workflow.\n- **Need something custom? Write a function.** A custom node is a Python function, so it can do whatever Python can.\n\nThe result is a multi-model pipeline that people can open in a browser, sign into, use right away, and call from code.\n\n## Build your own\n\nWorkflow1111 has 73 nodes, but it started with just this:\n\n```python\nimport gradio as gr\n\ndef your_function(text: str) -> str:\n    pass\n\ngr.Workflow(bind=[your_function]).launch()\n```\n\n`bind=` turns your functions into nodes, `edges=` connects them, and `.launch()` opens the canvas in your browser so you can keep editing there. When it's ready, `gradio deploy` puts the whole thing on a Space. The [gr.Workflow guide](https://gradio.app/guides/workflows) has the full details, including the JSON schema and every operator type.\n\nIf you'd rather start from something that already works, open [Workflow1111](https://huggingface.co/spaces/ysharma/Workflow1111), hit **Duplicate**, and pick one of the eleven pipelines to change: delete nodes, swap models, rewire the flow. If you'd rather start smaller, the [previous post](https://huggingface.co/blog/gradio-workflow-guide) has five workflows you can get running in about a minute each.\n\nWhatever you build, post it on X and tag [@gradio](https://x.com/Gradio). We'd be happy to amplify your workflows.\n",
  "dateCreated": "2026-10-19T01:26:53.998049939+00:00",
  "date_created": "2026-09-10T00:00:00+00:00",
  "date_modified": "2026-09-10T00:00:00+00:00",
  "date_published": "2026-09-10T00:00:00+00:00",
  "description": "In our last post, we built five small gr.Workflow graphs and hinted at what it would take to build something as complex as AUTOMATIC1111's stable-diffusion-webui. In this post we walk you through Workflow1111, where we have rebuilt most of…",
  "external_url": "https://huggingface.co/blog/gradio-workflow-1111",
  "git": {
    "commit": "ebb0941c5c06a2ab2377342d607535262a3e969e",
    "path": "items/huggingface-co/2026/09/2026-09-10-rebuilding-automatic1111-with-gradio-workflow.md",
    "permalink": "https://github.com/aymericbeaumet/aggr-instance/blob/ebb0941c5c06a2ab2377342d607535262a3e969e/items/huggingface-co/2026/09/2026-09-10-rebuilding-automatic1111-with-gradio-workflow.md"
  },
  "id": "urn:aggr:item:288422a2b3a397c032319978e8c9525f72979976",
  "isBasedOn": {
    "@id": "https://huggingface.co/blog/gradio-workflow-1111"
  },
  "mainEntity": {
    "@id": "https://huggingface.co/blog/gradio-workflow-1111",
    "@type": "CreativeWork",
    "archivedAt": {
      "@id": "https://aggr.aymericbeaumet.com/items/huggingface-co/2026-09-10-rebuilding-automatic1111-with-gradio-workflow/#webpage"
    },
    "dateModified": "2026-09-10T00:00:00+00:00",
    "datePublished": "2026-09-10T00:00:00+00:00",
    "headline": "Rebuilding AUTOMATIC1111 with Gradio Workflow",
    "image": {
      "@type": "ImageObject",
      "caption": null,
      "height": 90,
      "url": "https://huggingface.co/blog/assets/gradio-workflow1111/thumbnail.png",
      "width": 160
    },
    "timeRequired": "PT9M",
    "url": "https://huggingface.co/blog/gradio-workflow-1111",
    "wordCount": 1819
  },
  "name": "Archived snapshot: Rebuilding AUTOMATIC1111 with Gradio Workflow",
  "preview": {
    "alt": null,
    "color": null,
    "height": 90,
    "placeholder": {
      "data_url": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNk+A8AAQUBAScY42YAAAAASUVORK5CYII=",
      "hash": ""
    },
    "url": "https://huggingface.co/blog/assets/gradio-workflow1111/thumbnail.png",
    "width": 160
  },
  "reading_minutes": 9,
  "replicated_at": null,
  "source": "huggingface-co",
  "source_name": "Hugging Face - Blog",
  "summary": null,
  "tags": [],
  "temporalCoverage": "2026-10-19T01:26:53.998049939+00:00",
  "title": "Rebuilding AUTOMATIC1111 with Gradio Workflow",
  "url": "https://aggr.aymericbeaumet.com/items/huggingface-co/2026-09-10-rebuilding-automatic1111-with-gradio-workflow/",
  "word_count": 1819
}