Daggrの紹介:プログラムでチェーンアプリを構築し、視覚的に検査
Hugging Face が開発したオープンソースライブラリ「Daggr」は、Python コードで定義された AI ワークフローを自動的に可視化し、デバッグやステップごとの再実行を可能にするツールである。
キーポイント
コードファーストな可視化アプローチ
ドラッグ&ドロップ型エディタとは異なり、Python コードでワークフローを定義し、自動的にビジュアルキャンバスを生成する。これによりバージョン管理可能なコードと直感的な中間結果の検査を両立させる。
デバッグ機能の強化
複雑なパイプラインにおいて、特定のステップのみを検査・入力変更・再実行できるため、全体を再実行せずに効率的にデバッグが可能になる。
Gradio とのシームレス統合
Gradio チームが開発した同ツールは、パブリックまたはプライベートな Gradio Space をそのままノードとして参照可能にし、アダプターなしで連携する。
状態の永続化と管理
ワークフローの状態、入力値、キャッシュ結果、キャンバスの位置などを自動的に保存し、「シート」機能を用いて同一アプリ内で複数の作業スペースを維持できる。
多様なノードタイプのサポート
GradioNode、FnNode(カスタムPython関数)、InferenceNode(Hugging Faceモデル)の3種類のノードをサポートし、複雑なワークフローを構築可能。
視覚的なワークフロー管理と共有
実行時に自動的に可視化されたキャンバスを提供し、各ステップの入出力を確認・修正できるほか、GradioのtunnelingやHugging Face Spacesへのデプロイで簡単に公開可能。
Daggr を用いた多段階画像処理パイプラインの構築
背景除去、解像度調整、Flux.2による3D風強化、そしてTrellis.2による3D生成という4つのステップをFnNodeやInferenceNodeで連鎖させ、単一のアプリとして動作させる手法が示されています。
影響分析・編集コメントを表示
影響分析
このツールは、AI アプリケーション開発におけるデバッグのボトルネックを解消し、複雑なパイプラインの開発効率を劇的に向上させる可能性があります。特に Gradio エコシステムとの親和性が高いことで、プロトタイプから実装までのサイクルを短縮し、開発者の生産性を高める重要なインフラとなり得ます。
編集コメント
コードベースの開発を好むエンジニアにとって、可視化ツールとのギャップを埋める画期的なアプローチです。特に Gradio ユーザーにとっては、デバッグの負担が大幅に軽減される実用的なアップデートと言えます。

Daggrは、複雑なワークフローを構築するための視覚的インターフェースを提供します。ユーザーはノードをドラッグアンドドロップして接続し、データの流れを定義できます。各ノードは特定のタスクを表し、エッジはデータの依存関係を示します。
このプラットフォームは、機械学習モデル、データ処理パイプライン、API統合など、さまざまなアプリケーションをサポートしています。開発者は事前に構築されたコンポーネントを利用したり、カスタムノードを作成したりできます。
Daggrの主な機能の一つは、リアルタイムでの検査機能です。ユーザーは実行中のワークフローを監視し、中間データを検査し、パフォーマンスメトリクスを追跡できます。これにより、デバッグと最適化が容易になります。
さらに、Daggrはバージョン管理とコラボレーションツールを統合しています。チームメンバーはワークフローを共同で編集し、変更履歴を追跡し、異なるバージョンを比較できます。
セキュリティ面では、Daggrはエンドツーエンドの暗号化とアクセス制御を提供します。ユーザーはロールベースの権限を設定し、機密データを保護できます。
Daggrは、クラウドネイティブアーキテクチャを採用しており、スケーラビリティと柔軟性を実現しています。オンプレミスデプロイメントとクラウドデプロイメントの両方をサポートしています。
今後のロードマップには、高度な分析機能、拡張されたサードパーティ統合、強化された自動化ツールが含まれています。開発チームはユーザーフィードバックに基づいて継続的にプラットフォームを改善しています。
Daggrは、データサイエンティスト、ソフトウェアエンジニア、ビジネスアナリストなど、幅広いユーザーを対象としています。その直感的なインターフェースと強力な機能により、複雑なワークフローの管理を簡素化します。
詳細については、公式ドキュメントとコミュニティフォーラムを参照してください。無料トライアルと有料サブスクリプションプランが利用可能です。
原文を表示
Back to Articles Introducing Daggr: Chain apps programmatically, inspect visually
Upvote 103 ![]()





TL;DR: Daggr is a new, open-source Python library for building AI workflows that connect Gradio apps, ML models, and custom functions. It automatically generates a visual canvas where you can inspect intermediate outputs, rerun individual steps, and manage state for complex pipelines, all in a few lines of Python code!
Table of Contents
Getting Started
Sharing Your Workflows
End-to-End Example with Different Nodes
If you've built AI applications that combine multiple models or processing steps, you know the pain: chaining API calls, debugging pipelines, and losing track of intermediate results. When something goes wrong in step 5 of a 10-step workflow, you often have to re-run everything just to see what happened.
Most developers either build fragile scripts that are hard to debug or turn to heavy orchestration platforms designed for production pipelines—not rapid experimentation.
We've been working on Daggr to solve problems we kept running into when building AI demos and workflows:
Visualize your code flow: Unlike node-based GUI editors, where you drag and connect nodes visually, Daggr takes a code-first approach. You define workflows in Python, and a visual canvas is generated automatically. This means you get the best of both worlds: version-controllable code and visual inspection of intermediate outputs.
Inspect and Rerun Any Step: The visual canvas isn't just for show. You can inspect the output of any node, modify inputs, and rerun individual steps without executing the entire pipeline. This is invaluable when you're debugging a 10-step workflow and only step 7 is misbehaving. You can even provide “backup nodes” – replacing one model or Space with another – to build resilient workflows.
First-Class Gradio Integration: Since Daggr is built by the Gradio team, it works seamlessly with Gradio Spaces. Point to any public (or private) Space and you can use it as a node in your workflow. No adapters, no wrappers—just reference the Space name and API endpoint.
State Persistence: Daggr automatically saves your workflow state, input values, cached results, canvas position—so you can pick up where you left off. Use "sheets" to maintain multiple workspaces within the same app.
Getting Started
Install daggr with pip or uv, it just requires Python 3.10 or higher:
pip install daggr uv pip install daggr
Here's a simple example that generates an image and removes its background. Check out this Space’s API reference from the bottom of the Space to see which inputs it takes and which outputs it yields. In this example, the Space returns both original image and the edited image, so we return only the edited image.
import random import gradio as gr from daggr import GradioNode, Graph # Generate an image using a Gradio Space image_gen = GradioNode( "hf-applications/Z-Image-Turbo", api_name="/generate_image", inputs={ "prompt": gr.Textbox( label="Prompt", value="A cheetah sprints across the grassy savanna.", lines=3, ), "height": 1024, "width": 1024, "seed": random.random, }, outputs={ "image": gr.Image(label="Generated Image"), }, ) # Remove background using another Gradio Space bg_remover = GradioNode( "hf-applications/background-removal", api_name="/image", inputs={ "image": image_gen.image, # Connect to previous node's output }, outputs={ "original_image": None, # Hide this output "final_image": gr.Image(label="Final Image"), }, ) graph = Graph( name="Transparent Background Generator", nodes=[image_gen, bg_remover] ) graph.launch()
That's it. Run this script and you get a visual canvas served on port 7860 launched automatically, as well as a shareable live link, showing both nodes connected, with inputs you can modify and outputs you can inspect at each step.

Daggr supports three types of nodes:
GradioNode calls a Gradio Space API endpoint or locally served Gradio app. Passing run_locally=True
node = GradioNode( "username/space-name", api_name="/predict", inputs={"text": gr.Textbox(label="Input")}, outputs={"result": gr.Textbox(label="Output")}, ) # clone a Space locally and serve node = GradioNode( "hf-applications/background-removal", api_name="/image", run_locally=True, inputs={"image": gr.Image(label="Input")}, outputs={"final_image": gr.Image(label="Output")},
FnNode — runs a custom Python function:
def process(text: str) -> str: return text.upper() node = FnNode( fn=process, inputs={"text": gr.Textbox(label="Input")}, outputs={"result": gr.Textbox(label="Output")}, )
InferenceNode — calls a model via Hugging Face Inference Providers:
node = InferenceNode( model="moonshotai/Kimi-K2.5:novita", inputs={"prompt": gr.Textbox(label="Prompt")}, outputs={"response": gr.Textbox(label="Response")}, )
Sharing Your Workflows
Generate a public URL with Gradio's tunneling:
graph.launch(share=True)
For permanent hosting, deploy on Hugging Face Spaces using the Gradio SDK—just add daggr
requirements.txt
End-to-End Example with Different Nodes
We will now develop an app that takes in an image and generates a 3D asset. This demo can run on daggr 0.4.3. Here are the steps:
Take an image, remove the background: For this, we will clone the BiRefNet Space and run it locally.
Downscale the image for efficiency: We will write a simple function for this with FnNode.
Generate an image in 3D asset style for better results: We will use InferenceNode with Flux.2-klein-4B model on Inference Providers.
Pass the output image to a 3D generator: We will send the output image to the Trellis.2 Space hosted on Spaces.
Spaces that are run locally might take models to CUDA (with to.(“cuda”)
The resulting graph looks like below.

Let’s write the first step, which is the background remover. We will clone and run this Space locally. This Space runs on CPU, and takes ~13 seconds to run. You can swap with this app if you have an NVIDIA GPU.
from daggr import FnNode, GradioNode, InferenceNode, Graph background_remover = GradioNode( "merve/background-removal", api_name="/image", run_locally=True, inputs={ "image": gr.Image(), }, outputs={ "original_image": None, "final_image": gr.Image( label="Final Image" ), }, )
For the second step, we need to write a helper function to downscale the image and pass it to FnNode
from PIL import Image from daggr.state import get_daggr_files_dir def downscale_image_to_file(image: Any, scale: float = 0.25) -> str | None: pil_img = Image.open(image) scale_f = max(0.05, min(1.0, float(scale))) w, h = pil_img.size new_w = max(1, int(w * scale_f)) new_h = max(1, int(h * scale_f)) resized = pil_img.resize((new_w, new_h), resample=Image.LANCZOS) out_path = get_daggr_files_dir() / f"{uuid.uuid4()}.png" resized.save(out_path) return str(out_path)
We can now pass in the function to initialize the FnNode
downscaler = FnNode( downscale_image_to_file, name="Downscale image for Inference", inputs={ "image": background_remover.final_image, "scale": gr.Slider( label="Downscale factor", minimum=0.25, maximum=0.75, step=0.05, value=0.25, ), }, outputs={ "image": gr.Image(label="Downscaled Image", type="filepath"), }, )
We will now write the InferenceNode
flux_enhancer = InferenceNode( model="black-forest-labs/FLUX.2-klein-4B:fal-ai", inputs={ "image": downscaler.image, "prompt": gr.Textbox( label="prompt", value=("Transform this into a clean 3D asset render"), lines=3, ), }, outputs={ "image": gr.Image(label="3D-Ready Enhanced Image"), }, )
When deploying apps with InferenceNode to Hugging Face Spaces, use a fine-grained Hugging Face access token with the option "Make calls to Inference Providers" only.
Last node is 3D generation with querying the Trellis.2 Space on Hugging Face.
trellis_3d = GradioNode( "microsoft/TRELLIS.2", api_name="/image_to_3d", inputs={ "image": flux_enhancer.image, "ss_guidance_strength": 7.5, "ss_sampling_steps": 12, }, outputs={ "glb": gr.HTML(label="3D Asset (GLB preview)"), }, )
Chaining them together and launching the app is as simple as follows.
graph = Graph( name="Image to 3D Asset Pipeline", nodes=[background_remover, downscaler, flux_enhancer, trellis_3d], ) if __name__ == "__main__": graph.launch()
You can find the complete example running in this Space, to run locally you just need to take app.py, install requirements and login to Hugging Face Hub.
Daggr is in beta and intentionally lightweight. APIs may change between versions, and while we persist workflow state locally, data loss is possible during updates. If you have feature requests or find bugs, please open an issue here. We’re looking forward to your feedback! Share your daggr workflows on socials with Gradio for a chance to be featured. Check out all the featured works here.





関連記事
今日のまとめ
AI日報で今日の重要ニュースをまとめ読み