{"slug": "wire-it-run-it-deploy-it-ai-workflows-in-gradio", "title": "Wire It, Run It, Deploy It: AI Workflows in Gradio", "summary": "Hugging Face released gr.Workflow, a feature built into Gradio that turns AI pipelines into interactive drag-and-drop canvases where each node is runnable and every intermediate result is visible, while also serving as a REST API and enabling one-command deployment to Hugging Face Spaces. The tool supports chaining models like Qwen-Image-Edit, FLUX.1-schnell, and Qwen2.5-7B-Instruct via Inference Providers, parallel fan-out generation, dataset profiling with the Datasets Server API, and running GPU models locally with ZeroGPU, as demonstrated in live Spaces.", "body_md": "Text-to-Video • 13B • Updated • 1.58k • 60\n\n# Build Anything with gr.Workflow\n\n[Update on GitHub](https://github.com/huggingface/blog/blob/main/gradio-workflow-guide.md)\n\n** gr.Workflow**, built right into Gradio, makes the pipeline\n\n*the interface*. You describe your steps as a graph of typed nodes, and Gradio serves a drag-and-drop canvas where every node is runnable and every intermediate result is visible. The same graph is also a REST API and a one-command deploy to Hugging Face Spaces.\n\nThe best way to get the idea is to see a few workflows in action. Every app below is a live Huggingface Space you can open, run, and duplicate.\n\n## Edit an Image\n\nUpload an image, type an edit (\"turn it into a snowy winter scene\", \"add sunglasses\", \"make the car red\"), and get the edited photo back. The whole app is a single node calling [Qwen-Image-Edit](https://huggingface.co/Qwen/Qwen-Image-Edit) on Hugging Face Inference Providers.\n\n👉 [Try the Image Editor Pipeline](https://huggingface.co/spaces/ysharma/gr-workflow-image-editor)\n\n## Chain real models into a media studio\n\nOne graph, three pipelines. Start with a prompt and generate an image with [FLUX](https://huggingface.co/black-forest-labs/FLUX.1-schnell), then pass it to a [background-removal Gradio Space](https://huggingface.co/spaces/not-lain/background-removal) to turn it into a sticker. A topic becomes a voiceover through a [text-to-speech Gradio Space](https://huggingface.co/spaces/mrfakename/MeloTTS), while the same topic becomes a catchy episode title through an [LLM](https://huggingface.co/Qwen/Qwen2.5-7B-Instruct) call.\n\nThat’s one canvas, two model calls through Hugging Face [Inference Providers](https://huggingface.co/docs/inference-providers/en/index), and two calls to Gradio Spaces.\n\nSince this is a workflow, each of the three outputs also gets its own REST endpoint: `/sticker`\n\n, `/voiceover`\n\n, and `/episode_title`\n\n. You can call any of them directly from code without opening the UI. See [Call it from code](#call-it-from-code) below for a runnable example.\n\n## Fan-out image generation in parallel\n\nType in one idea, and it turns into a set of generated artwork all at once: a base image from FLUX, two AI re-imaginings of that image (a soft watercolor version and a neon cyberpunk take), and a gallery title written by an LLM.\n\nEach image is generated directly from the prompt by a model node using Inference Providers, while the title comes from an `fn`\n\nnode that calls an LLM. This is the fan-out pattern in action: one idea can feed multiple operators simultaneously, all generating in parallel.\n\n## Profile a Hugging Face dataset\n\nType in a Hugging Face dataset ID, such as `stanfordnlp/imdb`\n\nor `mteb/tweet_sentiment_extraction`\n\n, and a single input fans out to four operator nodes that analyze the dataset live using the [Datasets Server](https://huggingface.co/docs/dataset-viewer) API.\n\nYou get an overview card, a preview of the first few rows, per-column statistics, and a distribution chart, all computed independently and in parallel. That’s the power of workflows!\n\n## Run your own GPU model\n\nEvery node so far reaches out to Hugging Face. But an `fn`\n\nnode is just Python, which means it can also run a model inside the Space on a GPU.\n\nDecorate the bound function with `@spaces.GPU`\n\nand, when the node runs, [ZeroGPU](https://huggingface.co/docs/hub/spaces-zerogpu) grabs a GPU for that call, runs the model, and releases it. We don't always need to rely on Inference Providers or existing Gradio Spaces.\n\nCheck out this demo that animates a still image using [Lightricks/LTX-Video](https://huggingface.co/Lightricks/LTX-Video-0.9.7-distilled) loaded through Diffusers, running entirely through one node. `gr.Workflow`\n\ndoesn't need to know anything about your GPU setup. It simply calls the bound function.\n\n## How it works, in a nutshell\n\nEvery workflow is a graph with three kinds of nodes: **references** (your inputs), **operators** (the steps that do work), and **subjects** (your outputs). An operator can be your own Python function, a model on Hugging Face Inference Providers, another Gradio Space, or a row from a Hub dataset. You connect them by dragging between typed ports, hit Run, and watch each result appear in place.\n\n## Call it from code\n\nEvery workflow you build is also an API, with no extra work. Each output becomes a REST endpoint named after its label, and you can call it from Python with the Gradio client. Here is a live, no-token example against the multi-endpoint demo Space, exactly as-is:\n\n``` python\nfrom gradio_client import Client\n\nclient = Client(\"ysharma/gr-workflow-multi-endpoint-API\")\n\nprint(client.predict(\"hello there friend\", api_name=\"/word_count\"))  # -> 3\nprint(client.predict(20, api_name=\"/fahrenheit\"))                    # -> 68.0\n```\n\nEndpoints that call a model or a Space run under a Hugging Face token, so pass one when you create the client:\n\n``` python\nfrom gradio_client import Client, handle_file\n\nclient = Client(\"ysharma/gr-workflow-image-editor\", token=\"hf_...\")\n\nedited = client.predict(\n    handle_file(\"dog.jpg\"),\n    \"turn it into a snowy winter scene\",\n    api_name=\"/edited_image\",\n)\n```\n\nPrefer plain HTTP? Every endpoint is reachable over `curl`\n\ntoo:\n\n```\ncurl -s https://ysharma-gr-workflow-multi-endpoint-API.hf.space/gradio_api/call/word_count \\\n  -H \"Content-Type: application/json\" -d '{\"data\": [\"hello there friend\"]}'\n```\n\n## Build your own\n\nThe fastest way in is to open any demo above, click **Duplicate**, and start rewiring. From Python, it is as short as:\n\n``` php\nimport gradio as gr\n\ndef your_function(text: str) -> str:\n  pass\n\ngr.Workflow(bind=[your_function]).launch()\n```\n\nFor the full walkthrough, the operator kinds, the JSON schema, and reusable patterns, see the official [gr.Workflow guide](https://gradio.app/guides/workflows) in the Gradio docs.\n\nYou can even build something as involved as [AUTOMATIC1111](https://github.com/automatic1111/stable-diffusion-webui) with `gr.Workflow`\n\n. Keep an eye out for our next post, where we walk through building it step by step. Here is a sneak peek 😉👇", "url": "https://wpnews.pro/news/wire-it-run-it-deploy-it-ai-workflows-in-gradio", "canonical_source": "https://huggingface.co/blog/gradio-workflow-guide", "published_at": "2026-08-25 00:00:00+00:00", "updated_at": "2026-08-25 03:42:27.400428+00:00", "lang": "en", "topics": ["ai-tools", "developer-tools", "generative-ai", "ai-infrastructure"], "entities": ["Hugging Face", "Gradio", "Qwen-Image-Edit", "FLUX.1-schnell", "Qwen2.5-7B-Instruct", "ZeroGPU", "Lightricks/LTX-Video", "Datasets Server"], "alternates": {"html": "https://wpnews.pro/news/wire-it-run-it-deploy-it-ai-workflows-in-gradio", "markdown": "https://wpnews.pro/news/wire-it-run-it-deploy-it-ai-workflows-in-gradio.md", "text": "https://wpnews.pro/news/wire-it-run-it-deploy-it-ai-workflows-in-gradio.txt", "jsonld": "https://wpnews.pro/news/wire-it-run-it-deploy-it-ai-workflows-in-gradio.jsonld"}}