Skip to main content

A Python package

Project description

daggr Logo

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 API
  • FnNode: Runs a Python function
  • InferenceNode: Calls HuggingFace Inference API

Development

pip install -e ".[dev]"

Code Formatting

ruff check --fix --select I && ruff format

License

MIT License

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

daggr-0.2.0-py3-none-any.whl (374.4 kB view details)

Uploaded Python 3

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

Hashes for daggr-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 30a8dc0c511309192ab43e71bdcf6712996bc74c97b06722613b4f1c5e6be849
MD5 2fbffe8d6546755971191deefb2ae25c
BLAKE2b-256 57e9a5b2b1d6863514705ad5c1b14f93ead270f665ef0e24e14f04d508507058

See more details on using hashes here.

Provenance

The following attestation bundles were made for daggr-0.2.0-py3-none-any.whl:

Publisher: publish.yml on abidlabs/daggr

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page