Fal AI STT
The FalSTTService provides high-speed speech-to-text transcription using Fal's Wizper API. It is built as a segmented service, handling audio buffering and speech detection natively for optimal performance.
Installation
To use Fal AI, install the required dependencies:
pip install "piopiy-ai[fal]"
Prerequisites
- A Fal AI API key (Get yours here).
- Set your API key in your environment:
export FAL_KEY="your_api_key_here"
Configuration
FalSTTService Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
api_key | str | None | Your Fal API key (falls back to FAL_KEY). |
sample_rate | int | None | Audio sample rate in Hz. |
params | InputParams | None | Configuration parameters (see below). |
InputParams Parameters
| Option | Type | Default | Description |
|---|---|---|---|
language | Language | Language.EN | Language of the audio input. |
task | str | "transcribe" | Task to perform (transcribe or translate). |
chunk_level | str | "segment" | Level of audio chunking. |
version | str | "3" | Version of the Wizper model to use. |
Usage
Basic Setup
import os
from piopiy.services.fal.stt import FalSTTService
stt = FalSTTService(
api_key=os.getenv("FAL_KEY")
)
With Translation Task
import os
from piopiy.services.fal.stt import FalSTTService
from piopiy.transcriptions.language import Language
stt = FalSTTService(
api_key=os.getenv("FAL_KEY"),
params=FalSTTService.InputParams(
language=Language.FR, # Input is French
task="translate" # Translate to English
)
)
Notes
- Segmented Processing: Fal STT uses a segmented approach, meaning it processes chunks of audio after a pause in speech is detected, rather than token-by-token streaming.
- Translation Support: The
task="translate"parameter allows for real-time translation from any supported language into English.