gradio-app/daggr
Overview
This skill builds visual DAG-based AI pipelines that connect Gradio Spaces, HuggingFace inference providers, and Python functions into interactive workflows. It provides node types, port semantics, and tools to run, debug, and deploy multi-step AI applications with a visual DAG UI. Use it to prototype orchestrations that chain models, UI components, and custom logic quickly.
How this skill works
Create a Graph composed of node objects (GradioNode, InferenceNode, FnNode, ItemList) and define inputs/outputs and port connections between nodes. The graph launches a web server with a visual DAG UI for wiring inputs, running nodes, and inspecting outputs. Nodes can call Spaces via their API, invoke HF inference providers, or run local Python functions; ItemList supports scatter/gather patterns for per-item execution.
When to use it
- You need to chain multiple models and functions into a single end-to-end AI workflow.
- You want a visual interface to prototype and debug model orchestration and data flow.
- You need to call remote Gradio Spaces or HF inference providers and combine results with local code.
- You require per-item processing (dynamic lists) and later aggregation of results.
- You plan to deploy an orchestrated app to Hugging Face Spaces after iterating locally.
Best practices
- Check a Space's openapi.json before calling it to confirm endpoints and required params.
- Use postprocess functions to normalize multi-return Space responses and file dicts.
- Test nodes in isolation with node.test(...) during development to catch input/output mismatches.
- Store HF tokens securely (env var or deploy secrets). Prompt users to provide tokens client-side when needed.
- Use ItemList for scatter/gather workloads and avoid unnecessary network calls by batching where possible.
Example use cases
- Image generation pipeline: prompt → image model Space → image postprocess → image-to-video model.
- Multi-step TTS app: text input → LLM for script → TTS Space → audio combine with background music via FnNode.
- Document pipeline: OCR Space → text cleanup FnNode → summarization model (InferenceNode) → export.
- Dataset processing: generate items with FnNode, run per-item model inference, then gather results for ranking or aggregation.
- Prototype a public demo by launching graph.launch() locally, then deploy to a HF Space with daggr deploy.
FAQ
Yes. InferenceNode and some Spaces require a Hugging Face token. Use HF_TOKEN env var for local runs or ask users to paste tokens in the UI for persisted client sessions.
How do I handle file objects returned by Spaces?
Gradio often returns dicts for files. Use file.get("path") if isinstance(file, dict) else file to extract a filesystem path, and use postprocess to normalize outputs.