Skip to content

Conversation

@woonys
Copy link

@woonys woonys commented Apr 29, 2025

Overview

This PR adds a FastAPI-based REST API server to Dia, enabling the model to be easily integrated with web applications and other services without requiring direct Python imports.
The API server complements the existing Python library usage pattern without modifying core functionality.

Key Features

REST API Endpoints:

  • /generate: Convert text to speech with support for all model parameters
  • /voice-clone: Clone voices from uploaded audio samples
  • /batch: Process multiple texts asynchronously with progress tracking
  • /health: Check server status and model availability

Implementation Details:

  • Clean separation from core model logic
  • Resource-efficient caching for repeated requests
  • Robust error handling and logging
  • CORS support for web integrations
  • Proper memory management and resource cleanup

Documentation:

  • Updated README with API usage instructions

Testing

Tested on GPU environments

Additional Resources

  • Colab notebook for easy testing available at: Link

will continue to update as more projects are released!)

Potential Impact

  • This addition significantly expands Dia's potential use cases, especially for:
    • Web applications and services
    • Non-Python environments
    • Microservice architectures
    • Edge deployments with REST API requirements

@woonys woonys force-pushed the feature/fast-api branch from c42973c to e0be990 Compare April 29, 2025 08:46
@jaehong21 jaehong21 added the enhancement New feature or refactor label Apr 29, 2025
@jaehong21 jaehong21 self-assigned this Apr 29, 2025
Copy link
Collaborator

@buttercrab buttercrab left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move all the changes to examples/fastapi.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or refactor

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants