fastrtc  by gradio-app

Python library for real-time communication

created 10 months ago
4,168 stars

Top 12.0% on sourcepulse

GitHubView on GitHub
1 Expert Loves This Project
Project Summary

FastRTC is a Python library designed to simplify real-time audio and video communication by enabling developers to turn any Python function into a WebRTC or WebSocket stream. It targets developers building interactive applications, voice assistants, and real-time media processing tools, offering automatic UI generation, WebRTC/WebSocket/telephone integration, and a customizable backend.

How It Works

FastRTC leverages a Stream class that wraps user-defined Python functions, abstracting the complexities of real-time protocols like WebRTC and WebSockets. It handles media encoding/decoding, network transport, and provides optional integrations for features like pause detection, text-to-speech, and even direct telephone connectivity via temporary phone numbers. The library can automatically generate a Gradio UI for easy testing or be mounted onto a FastAPI application for custom frontends and production deployments.

Quick Start & Requirements

  • Install: pip install fastrtc
  • Optional extras: pip install "fastrtc[vad, tts]"
  • Dependencies: Python, Gradio, FastAPI, Hugging Face Hub, various audio/video processing libraries.
  • Demo code and examples are available in the Cookbook.

Highlighted Details

  • Supports audio, video, and combined audio-video modalities.
  • Offers multiple deployment options: built-in Gradio UI (.ui.launch()), FastAPI integration (.mount(app)), and direct telephone calls (.fastphone()).
  • Integrates with popular LLM and AI services like Google Gemini, OpenAI, Anthropic Claude, and Whisper for voice interactions.
  • Includes examples for object detection (YOLOv10) and custom JavaScript frontends.

Maintenance & Community

The project is associated with gradio-app. Further community and roadmap details are not explicitly provided in the README.

Licensing & Compatibility

The README does not specify a license. Compatibility for commercial use or closed-source linking is not detailed.

Limitations & Caveats

The .fastphone() feature requires a Hugging Face token. The README mentions "free temporary phone number," implying potential limitations or costs associated with this service. Some advanced integrations, like the Llama Code Editor, are noted as being powered by specific hardware (SambaNova systems), which may not be universally accessible.

Health Check
Last commit

3 days ago

Responsiveness

1 day

Pull Requests (30d)
3
Issues (30d)
10
Star History
382 stars in the last 90 days

Explore Similar Projects

Starred by Chip Huyen Chip Huyen(Author of AI Engineering, Designing Machine Learning Systems), Andre Zayarni Andre Zayarni(Cofounder of Qdrant), and
2 more.

RealChar by Shaunwei

0.1%
6k
Real-time AI character/companion creation and interaction codebase
created 2 years ago
updated 1 year ago
Feedback? Help us improve.