Skip to main content

The realtime communication library for Python - fastrtc with Nvidia's Canary STT

Project description

FastRTC Canary

FastRTC Logo
Static Badge Static Badge

The Real-Time Communication Library for Python with Canary STT

Turn any python function into a real-time audio and video stream over WebRTC or WebSockets.

Installation

Assume you have fastrtc installed - fastrtc

pip install fastrtc_canary

Features

  • 🎯 Direct integration with Nvidia's Canary STT model
  • 🔄 Seamless compatibility with all FastRTC features
  • 🚀 Real-time audio transcription
  • 🔌 Drop-in replacement for FastRTC's STT components

Quick Start

from fastrtc_canary import get_stt_model as get_stt_model_canary
from fastrtc import (ReplyOnPause, Stream, get_tts_model, list_stt_models)
from groq import Groq

print(f"Available STT models: {list_stt_models()}")  
# Available STT models: ['moonshine/base', 'moonshine/tiny', 'canary/1b']

client = Groq()
stt_model = get_stt_model_canary(
                        "canary/1b",
                        lang="en"  # Optional, defaults to "en"
                    )
tts_model = get_tts_model()

def echo(audio):
    prompt = stt_model.stt(audio)

    response = (
        client.chat.completions.create(
            model="llama-3.1-8b-instant",
            max_tokens=200,
            messages=[
                    {"role": "system", "content": "You are a helpful assistant."},
                    {"role": "user", "content": prompt}
                ]
        )
        .choices[0]
        .message.content
    )

    for audio_chunk in tts_model.stream_tts_sync(response):
        yield audio_chunk

stream = Stream(ReplyOnPause(echo), modality="audio", mode="send-receive")

stream.ui.launch()

Requirements

  • Python >= 3.10
  • FastRTC >= 0.0.14
  • Groq >= 0.20.0

Documentation

For more detailed information about the base FastRTC package, visit https://fastrtc.org

License

MIT

Project details


Download files

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

Source Distribution

fastrtc_canary-0.0.1.tar.gz (1.1 MB view details)

Uploaded Source

Built Distribution

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

fastrtc_canary-0.0.1-py3-none-any.whl (809.9 kB view details)

Uploaded Python 3

File details

Details for the file fastrtc_canary-0.0.1.tar.gz.

File metadata

  • Download URL: fastrtc_canary-0.0.1.tar.gz
  • Upload date:
  • Size: 1.1 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.6

File hashes

Hashes for fastrtc_canary-0.0.1.tar.gz
Algorithm Hash digest
SHA256 bea07925943e796a80da2798e374e0bd4a220827d5210a9ee9f759a0fd6dea9d
MD5 e20d046d0f13a9595357d75876386a3a
BLAKE2b-256 48cd6c124fcd9591b91364b332e631c8e79502958452bc57df4d527ac191ceb0

See more details on using hashes here.

File details

Details for the file fastrtc_canary-0.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for fastrtc_canary-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 3744856dfb4f8cde8177dae3f8076ebaed871c67c4d5b5c9408c40bd70126134
MD5 6a21796a447bfc893919415fc7ef5589
BLAKE2b-256 09c63bc95ebb4bc960e5b4e95fc36a81d3af9fe68a1406378bd05fe2eef9d269

See more details on using hashes here.

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