A Python package
Project description
DAG-based Gradio workflows!
DAG-based Gradio workflows!
daggr is a Python library for building AI workflows that connect Gradio Spaces, ML models, and custom functions.
Installation
pip install daggr
Usage
Define nodes with inputs and outputs dicts. Inputs can be Gradio components (for UI), port references (for connections), or fixed values.
Basic Example
import gradio as gr
from daggr import Graph, FnNode, GradioNode
host_voice = GradioNode(
space_or_url="Qwen/Qwen3-TTS",
api_name="/generate_voice_design",
inputs={
"voice_description": gr.Textbox(label="Host Voice", value="Professional British voice..."),
"language": "auto",
"text": "Hello, welcome to the show!",
},
outputs={
"audio": gr.Audio(label="Host Voice"),
"status": gr.Text(visible=False),
},
)
guest_voice = GradioNode(
space_or_url="Qwen/Qwen3-TTS",
api_name="/generate_voice_design",
inputs={
"voice_description": gr.Textbox(label="Guest Voice", value="Friendly American voice..."),
"language": "auto",
"text": "Thanks for having me!",
},
outputs={
"audio": gr.Audio(label="Guest Voice"),
"status": gr.Text(visible=False),
},
)
def generate_dialogue(topic: str, host_voice: str, guest_voice: str) -> dict:
return {"dialogue": f"Topic: {topic}", "metadata": {"host": host_voice, "guest": guest_voice}}
dialogue = FnNode(
fn=generate_dialogue,
inputs={
"topic": gr.Textbox(label="Topic", value="AI in healthcare"),
"host_voice": host_voice.audio,
"guest_voice": guest_voice.audio,
},
outputs={
"dialogue": gr.JSON(label="Dialogue"),
"metadata": gr.Markdown(label="Metadata"),
},
)
graph = Graph(name="Podcast Generator", nodes=[host_voice, guest_voice, dialogue])
graph.launch()
Input Types
- Gradio component: Creates a UI input (e.g.,
gr.Textbox(label="Topic")) - Port reference: Connects to another node's output (e.g.,
other_node.output_name) - Fixed value: Constant value, no UI (e.g.,
"auto")
Node Types
GradioNode: Calls a Gradio Space APIFnNode: Runs a Python functionInferenceNode: Calls HuggingFace Inference API
Development
pip install -e ".[dev]"
Code Formatting
ruff check --fix --select I && ruff format
License
MIT License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file daggr-0.2.0-py3-none-any.whl.
File metadata
- Download URL: daggr-0.2.0-py3-none-any.whl
- Upload date:
- Size: 374.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.2.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
30a8dc0c511309192ab43e71bdcf6712996bc74c97b06722613b4f1c5e6be849
|
|
| MD5 |
2fbffe8d6546755971191deefb2ae25c
|
|
| BLAKE2b-256 |
57e9a5b2b1d6863514705ad5c1b14f93ead270f665ef0e24e14f04d508507058
|
Provenance
The following attestation bundles were made for daggr-0.2.0-py3-none-any.whl:
Publisher:
publish.yml on abidlabs/daggr
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
daggr-0.2.0-py3-none-any.whl -
Subject digest:
30a8dc0c511309192ab43e71bdcf6712996bc74c97b06722613b4f1c5e6be849 - Sigstore transparency entry: 849399402
- Sigstore integration time:
-
Permalink:
abidlabs/daggr@cd421d93b50be7f9bf454fa6b32ec2034bd1c6f2 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/abidlabs
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@cd421d93b50be7f9bf454fa6b32ec2034bd1c6f2 -
Trigger Event:
push
-
Statement type: