Using Gladia's Whisper API for transcribing YouTube videos
Project description
WhisperYT is a Python client for interacting with Gladia's API designed specifically for transcribing YouTube videos. Powered by an optimized variant of OpenAI's Whisper model, Gladia's backend performs Automatic Speech Recognition (ASR), converting spoken words into written text with remarkable precision. Best of all, you can enjoy up to 10 hours of free API usage each month.
In addition to providing access to Gladia's API, this versatile library equips you with postprocessing features to effortlessly manipulate and refine your transcribed data, making it a valuable tool for post-transcription tasks.
Install ![](https://pypi-camo.freetls.fastly.net/f643c5ded20f5057807c7222657f0a43e78082e7/68747470733a2f2f6d656469612e67697068792e636f6d2f6d656469612f73554c4b4567444d58384c63492f67697068792e676966)
pip install whisperyt
Quick Start ![](https://pypi-camo.freetls.fastly.net/1c18b539b53933563c2b440e600c71e4f83eebae/68747470733a2f2f6d656469612e67697068792e636f6d2f6d656469612f5065614e506c794f56504e4d486a71546d372f67697068792e676966)
The initial step involves initializing the YouTubeTranscriber
class before proceeding with your API request. To get started, simply create a free account on Gladia's site and provide your API token. Afterwards, pass the YouTube video URL of your choice:
from whisperyt import YouTubeTranscriber, DataProcessor
gladia = YouTubeTranscriber("YOUR-API-KEY")
response = gladia.transcribe("https://www.youtube.com/watch?v=BrcKRhQ7K00")
print(DataProcessor.pretty_json(response))
Chunk of output:
Save Transcription to JSON File
from whisperyt import YouTubeTranscriber, DataProcessor
gladia = YouTubeTranscriber("YOUR-API-KEY")
response = gladia.transcribe("https://www.youtube.com/watch?v=BrcKRhQ7K00")
DataProcessor.save_json_file(response.json(), "output.json")
View Transcription in Pandas Dataframe
After your transcription has been saved in a JSON file, you can load it in a Pandas Dataframe:
df = DataProcessor.get_table("output.json")
print(df)
Output:
View Transcription by Speaker Turn:
From Dataframe, display transcription by speaker turn:
df = DataProcessor.get_table("output.json")
DataProcessor.print_transcription_by_turn(df)
Output:
Best Practices with Gladia's API
Audio Length: The maximum length of audio that can be transcribed in a single request is currently 135 minutes. Attempts to transcribe longer audio files may result in errors.
File Size: Audio files must not exceed 500 MB in size. Larger files will not be accepted by the API.
API Call Limits: To ensure the quality of service and fairness to all users, API call limits have been implemented. For the free tier, users can make a maximum of 20 calls per hour, with up to 3 concurrent requests. Users subscribed to the Pro tier can make up to 200 calls per minute and up to 15 concurrent requests.
For further details, refer to the documentation.
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
Built Distribution
Hashes for whisperyt-0.1.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | de7e1f666bfb11af13b9aa3a17d384b2d469da8d891f350f668e428d06359d52 |
|
MD5 | bb1d7dd6eebc85e7a34f97e309fb7775 |
|
BLAKE2b-256 | e48397b6ff0b981476f66af2f8b4d5b649107076535e0b6d27a5de68495a696f |