Transcribe audio with Ruby utilizing Universal-1

We not too long ago introduced our newest speech recognition mannequin, Universal-1, which achieves state-of-the-art speech-to-text accuracy. Trained on thousands and thousands of hours of audio knowledge, Universal-1 demonstrates near-human accuracy, even with accented speech, background noise, and troublesome phrases like flight numbers and e mail addresses.
Universal-1 can be an order of magnitude sooner than our earlier mannequin, Conformer-2, and helps English, Spanish, French, and German, with extra languages coming shortly.
Along with Universal-1, we’ve additionally launched two new lessons of fashions: Best and Nano. Best enables you to make the most of Universal-1 for functions the place accuracy is paramount. Nano is our new cost-effective different with assist for 99 completely different languages.
In this put up, you’ll learn to transcribe an audio file in your Ruby functions utilizing Universal-1 and Nano.
Set up the AssemblyAI Ruby SDK
The best method to transcribe audio is by utilizing one in every of our official SDKs.
To set up the AssemblyAI Ruby SDK, add the gem to your bundle and set up the bundle:
bundle add assemblyai
bundle set up
Create a brand new file principal.rb, and configure a brand new authenticated SDK shopper utilizing your AssemblyAI API key out of your account dashboard.
require 'assemblyai'
shopper = AssemblyAI::Client.new(
api_key: ENV['ASSEMBLYAI_API_KEY']
)
You’ll discover all of the operations you want on the AssemblyAI occasion.
Transcribe an audio file utilizing Universal-1
All transcriptions use the Best by default, so that you’ll at all times get the very best accuracy with none additional configuration.
Use the next code to transcribe an audio file from a URL utilizing Best:
transcript = shopper.transcripts.transcribe(
audio_url: "https://storage.googleapis.com/aai-web-samples/5_common_sports_injuries.mp3"
)
elevate transcript.error except transcript.error.nil?
places transcript.textual content
If you as a substitute wish to transcribe an area file, you may add the file to AssemblyAI and go the uploaded file URL to the transcribe technique:
uploaded_file = shopper.recordsdata.add(file: './audio.mp3')
transcript = shopper.transcripts.transcribe(audio_url: uploaded_file.upload_url)
elevate transcript.error except transcript.error.nil?
places transcript.textual content
To run your software, configure your ASSEMBLYAI_API_KEY as an setting variable, and use the next command to execute the code:
ruby principal.rb
Nano—a cheap different
Switching between Best and Nano is simply a matter of setting the speech mannequin parameter. To use Nano, set the speech_model to AssemblyAI::Transcripts::SpeechMannequin::NANO:
transcript = shopper.transcripts.transcribe(
audio_url: "https://storage.googleapis.com/aai-web-samples/5_common_sports_injuries.mp3",
speech_model: AssemblyAI::Transcripts::SpeechMannequin::NANO
)
Best, Nano and More with Audio Intelligence
We simply used Universal-1 via each the Best and Nano class of fashions to transcribe audio.
Next, there are various additional options that AssemblyAI affords past transcription to discover, equivalent to:
- Entity detection to mechanically determine and categorize key info.
- Content moderation for detecting inappropriate content material in audio recordsdata to make sure that your content material is protected for all audiences.
- PII redaction to attenuate delicate details about people by mechanically figuring out and eradicating it out of your transcript.
- LeMUR for making use of Large Language Models (LLMs) to audio knowledge in a single line of code.
You may study extra about our strategy to creating superhuman Speech AI fashions on our Research web page.
HI-FI News
by way of News, Tutorials, AI Research https://ift.tt/MGHUNTB
April 18, 2024 at 05:59PM
-
Product on sale
Audiophile Vinyl Records Cleaning BundleOriginal price was: €69.90.€59.90Current price is: €59.90. incl. VAT -
Product on sale
Easy Start Vinyl Records Cleaning KitOriginal price was: €69.90.€59.90Current price is: €59.90. incl. VAT -
Vinyl Records Cleaner Easy Groove Concentrate€34.95 incl. VAT -
Easy Groove Super Set€199.00 incl. VAT -
Easy Groove Enzycaster – vinyl records prewash cleaner€34.95 incl. VAT -
Easy Groove Extreme MK. II- vinyl records prewash cleaner€45.00 incl. VAT -
Vinyl Records Cleaner – Easy Groove Virgin Concentrate€35.00 incl. VAT -
Easy Groove Spray&Wipe vinyl records cleaner€34.95 incl. VAT








