A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://python.langchain.com/docs/integrations/document_loaders/google_speech_to_text/ below:

Google Speech-to-Text Audio Transcripts | 🦜️🔗 LangChain

The SpeechToTextLoader allows to transcribe audio files with the Google Cloud Speech-to-Text API and loads the transcribed text into documents.

To use it, you should have the google-cloud-speech python package installed, and a Google Cloud project with the Speech-to-Text API enabled.

First, you need to install the google-cloud-speech python package.

Follow the quickstart guide in the Google Cloud documentation to create a project and enable the API.

The SpeechToTextLoader must include the project_id and file_path arguments. Audio files can be specified as a Google Cloud Storage URI (gs://...) or a local file path.

Only synchronous requests are supported by the loader, which has a limit of 60 seconds or 10MB per audio file.

from langchain_google_community import SpeechToTextLoader

project_id = "<PROJECT_ID>"
file_path = "gs://cloud-samples-data/speech/audio.flac"


loader = SpeechToTextLoader(project_id=project_id, file_path=file_path)

docs = loader.load()

Note: Calling loader.load() blocks until the transcription is finished.

You can specify the config argument to use different speech recognition models and enable specific features.

If you don't specify a config, the following options will be selected automatically:

from google.cloud.speech_v2 import (
AutoDetectDecodingConfig,
RecognitionConfig,
RecognitionFeatures,
)
from langchain_google_community import SpeechToTextLoader

project_id = "<PROJECT_ID>"
location = "global"
recognizer_id = "<RECOGNIZER_ID>"
file_path = "./audio.wav"

config = RecognitionConfig(
auto_decoding_config=AutoDetectDecodingConfig(),
language_codes=["en-US"],
model="long",
features=RecognitionFeatures(
enable_automatic_punctuation=False,
profanity_filter=True,
enable_spoken_punctuation=True,
enable_spoken_emojis=True,
),
)

loader = SpeechToTextLoader(
project_id=project_id,
location=location,
recognizer_id=recognizer_id,
file_path=file_path,
config=config,
)

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4