Skip to main content

Fal AI 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

ParameterTypeDefaultDescription
api_keystrNoneYour Fal API key (falls back to FAL_KEY).
sample_rateintNoneAudio sample rate in Hz.
paramsInputParamsNoneConfiguration parameters (see below).

InputParams Parameters

OptionTypeDefaultDescription
languageLanguageLanguage.ENLanguage of the audio input.
taskstr"transcribe"Task to perform (transcribe or translate).
chunk_levelstr"segment"Level of audio chunking.
versionstr"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.