Getting Started with Speech Recognition in Python + Speaker Detection

AssemblyAI · Beginner ·🛠️ AI Tools & Apps ·2y ago

Key Takeaways

The video demonstrates how to use AssemblyAI's speech recognition API in Python, including transcription, speaker detection, and customization options. It covers the basics of setting up an AssemblyAI account, installing the Python SDK, and using the API to transcribe audio files.

Full Transcript

assembly AI is building the best API platform for developers to transform and understand voice data so that they can build amazing new products and services for the world to use you can transcribe your audio data with assembly AI or get a speaker labeled version of your transcription but you can do much more you can get a list of topics discussed whether there was any flaged content in there whether there was any personally sensitive information in there or the sentiment of each of your files you can also use an nlm through assembly AI seamlessly by using our lemur endpoint for everything I mentioned here and more we have a tutorial on our YouTube channel I will leave the links to each of these tutorials in the description below but today in this video let's take a look at how you can start using assembly ai's latest model universal one all right let's get started so all of the code that I'm using here is available on the assembly AI docs so if you just go to assembly ai.com dooc and go to the speech recognition section you will have access to all of the code that I'm building here and actually you could just copy and paste this code if you already log into assembly AI even your API key will be already inserted but to make it easier to follow I will start building the code here as we go along first we need to import assembly ai's python SDK very simply by saying import assembly AI as a AI if you don't have assembly AIS python SDK yet you can easily install it by running the command pip install assembly AI next I just need to set my assembly AI API key if you don't have an assembly AI account yet you can easily go to assembly a.com and create an account in just a couple of minutes and then you will immediately have your API key and then it's time to define the audio data that I'm going to pass to assembly AI you basically have two options for this you can either pass assembly AI a URL a link pointing to a audio or video file or if you have an audio or video file in your own system you can upload it to assembly AI either way it's the same way of working we just need to give it either the path or the link to this file that we have that we want to transcribe I will pass it a sample file that we use quite often where two speakers are uh discussing the Canadian wildfires and then we will Define a transcriber object and through this transcriber object I'm going to call the transcribe Ty function and pass it my audio URL and as a result we're going to get a transcript so let's print this transcript first the response to the transcrip function includes more than just a transcription text it includes some extra information so if you just want the text of this transcription we just need to call transcript. text so let's run this example and then take a look at what the transcription looks like then I'm going to show you some ways of customizing your output with assembly the AI so this is our transcription as you can see it is already finalized it has punctuation it has capitalization of the first letters and also proper nouns let's take a look at some ways to customize our assembly ai's API call so first of all how can you use universal one assembly ai's latest model well fortunately assembly ai's API by default uses Universal One's best tier so when you're calling the transcribe function on the transcriber you are automatically choosing to use the best version the best model assembly AI has to offer if you have a use case where you do not need the best tier speech recognition instead you just want to do some bulk transcription for even a better price then you can use the Nano tier of assem the AI so let me show you how you can do that here so for that we're just going to have to pass a config argument a configuration argument to our transcriber so I will call transcript I config here and then I will specify the speech model so the options are speech model either best which is the default option or you can use Nano which is a less accurate but less expensive option and then we need to pass this configuration to the transcriber we probably won't see a big difference in the example right here in front of us so I'm not going to run this one but I will show you some other configuration changes that you can make for example like we said in the transcription that we got we already have some styling right we have the punctuation we have the capitalization of the relevant sentences and the letters if you want you can turn this off for that you just need to set punctuate to false which is by default true and formatting format text to false and then let's run this example again and see how our transcription is different this time all right let's take a look we do not have punctuations unless it is absolutely relevant and we do not have the capitalization or any other formatting of the text so if you want only the ra text that's the way to go assembly AI by default transcribes the files assuming they're in English but if you have a file that is in another language you can set your language manually on assembly AI for that you just need to make a new line on your configuration and say language code to for example Spanish you can find all the languages assembly AI supports on our documentation if you don't know the language that your audio file is in or you don't want to manually pass it to assembly AI you can also set automatic language detection to True let's see this in an example so now I will pass a audio file that's in Spanish to assembly AI but but I want the text to be punctuated and formatted and I want to use the best possible tier from assembly AI so let's run this and see let's take a look at the results without us specifying to assembly AI that this audio file was in Spanish it understood that it was in Spanish and it gave us a transcription all in Spanish and I know in this audio file we have multiple speakers so let's try to get assembly AI to get us the speaker labels and once again again all I have to do is to add one line where I will set speaker labels to true but this time instead of just printing the text we need to print the results of the speaker diarization all right let's try this out let's take a look at our results this is basically a street interview kind of video so that's why you can see we have a lot of different speakers so speaker a very likely is the interviewer and everyone else all all the way up to speaker f are people that are being interviewed as you can see all of the sentences or the group of sentences are attributed to a speaker if you make an account with assembly AI today you will have access to all of these functionalities and customizations and more only for 37 cents an hour for the best tier and 12 cents an hour for the Nano tier if you want to track your usage you can always go to your assembly AI dashboard where you can see the number of hours you're transcribing and how much it costs you next if you want to learn how to transcribe a stream of audio with assembly AI you can watch this video thank you for watching and we cannot wait to see what you will build with assembly AI

Original Description

Get your AssemblyAI API key for this tutorial: https://www.assemblyai.com/?utm_source=youtube&utm_medium=referral&utm_campaign=yt_mis_62 AssemblyAI is building the best API platform for developers to transform and understand voice data with AI so that you can build amazing new products and services for the world to use. What is possible with AssemblyAI? You can transcribe an audio file, get speaker labels, get a list of topics discussed, the sentiment of sentences and much more. Take a look at our docs for a full list of audio intelligence capabilities and customization options of AssemblyAI: https://www.assemblyai.com/docs/?utm_source=youtube&utm_medium=referral&utm_campaign=yt_mis_62 AssemblyAI supports 20 languages including English, Spanish, German, French, Korean, Polish, Turkish, Vietnamese and much more. In this video, we will get started with AssemblyAI's newest and most accurate model to date: Universal-1. AssemblyAI docs: https://www.assemblyai.com/docs/?utm_source=youtube&utm_medium=referral&utm_campaign=yt_mis_62 00:00 Introduction 00:49 Simple transcription 03:10 Changing speech recognition model tier 04:32 Customizing the transcription 05:17 Automatic language detection 06:21 Getting speaker labels 07:08 Pricing and AssemblyAI Dashboard 07:31 Next video ▬▬▬▬▬▬▬▬▬▬▬▬ CONNECT ▬▬▬▬▬▬▬▬▬▬▬▬ 🖥️ Website: https://www.assemblyai.com/?utm_source=youtube&utm_medium=referral&utm_campaign=yt_mis_62 🐦 Twitter: https://twitter.com/AssemblyAI 🦾 Discord: https://discord.gg/Cd8MyVJAXd ▶️ Subscribe: https://www.youtube.com/c/AssemblyAI?sub_confirmation=1 🔥 We're hiring! Check our open roles: https://www.assemblyai.com/careers ▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬ #MachineLearning #DeepLearning
Watch on YouTube ↗ (saves to browser)
Sign in to unlock AI tutor explanation · ⚡30

Playlist

Uploads from AssemblyAI · AssemblyAI · 0 of 60

← Previous Next →
1 Python Speech Recognition in 5 Minutes
Python Speech Recognition in 5 Minutes
AssemblyAI
2 Python Click Part 1 of 4
Python Click Part 1 of 4
AssemblyAI
3 Python Click Part 2 of 4
Python Click Part 2 of 4
AssemblyAI
4 Python Click Part 3 of 4
Python Click Part 3 of 4
AssemblyAI
5 Python Click Part 4 of 4
Python Click Part 4 of 4
AssemblyAI
6 Deep learning in 5 minutes | What is deep learning?
Deep learning in 5 minutes | What is deep learning?
AssemblyAI
7 How to make a web app that transcribes YouTube videos with Streamlit | Part 1
How to make a web app that transcribes YouTube videos with Streamlit | Part 1
AssemblyAI
8 How to make a web app that transcribes YouTube videos with Streamlit | Part 2
How to make a web app that transcribes YouTube videos with Streamlit | Part 2
AssemblyAI
9 Batch normalization | What it is and how to implement it
Batch normalization | What it is and how to implement it
AssemblyAI
10 Real-time Speech Recognition in 15 minutes with AssemblyAI
Real-time Speech Recognition in 15 minutes with AssemblyAI
AssemblyAI
11 Regularization in a Neural Network | Dealing with overfitting
Regularization in a Neural Network | Dealing with overfitting
AssemblyAI
12 Add speech recognition to your Streamlit apps in 5 minutes
Add speech recognition to your Streamlit apps in 5 minutes
AssemblyAI
13 Transformers for beginners | What are they and how do they work
Transformers for beginners | What are they and how do they work
AssemblyAI
14 Automatic Chapter Detection With AssemblyAI | Python Tutorial
Automatic Chapter Detection With AssemblyAI | Python Tutorial
AssemblyAI
15 Deep Learning Series Part 1 - What is Deep Learning?
Deep Learning Series Part 1 - What is Deep Learning?
AssemblyAI
16 Deep Learning Series part 2 - Why is it called “Deep Learning”?
Deep Learning Series part 2 - Why is it called “Deep Learning”?
AssemblyAI
17 Activation Functions In Neural Networks Explained | Deep Learning Tutorial
Activation Functions In Neural Networks Explained | Deep Learning Tutorial
AssemblyAI
18 Deep Learning Series part 3 - Deep Learning vs. Machine Learning
Deep Learning Series part 3 - Deep Learning vs. Machine Learning
AssemblyAI
19 Deep Learning Series part 4 - Why is Deep Learning better for NLP?
Deep Learning Series part 4 - Why is Deep Learning better for NLP?
AssemblyAI
20 Intro to Batch Normalization Part 1
Intro to Batch Normalization Part 1
AssemblyAI
21 Intro to Batch Normalization Part 2
Intro to Batch Normalization Part 2
AssemblyAI
22 Intro to Batch Normalization Part 3 - What is Normalization?
Intro to Batch Normalization Part 3 - What is Normalization?
AssemblyAI
23 Intro to Batch Normalization Part 4
Intro to Batch Normalization Part 4
AssemblyAI
24 Intro to Batch Normalization Part 5
Intro to Batch Normalization Part 5
AssemblyAI
25 Sentiment Analysis for Earnings Calls with AssemblyAI
Sentiment Analysis for Earnings Calls with AssemblyAI
AssemblyAI
26 Summarizing my favorite podcasts with Python
Summarizing my favorite podcasts with Python
AssemblyAI
27 Introduction to Regularization
Introduction to Regularization
AssemblyAI
28 How/Why Regularization in Neural Networks?
How/Why Regularization in Neural Networks?
AssemblyAI
29 Getting Started With Torchaudio | PyTorch Tutorial
Getting Started With Torchaudio | PyTorch Tutorial
AssemblyAI
30 Types of Regularization
Types of Regularization
AssemblyAI
31 Tuning Alpha in L1 and L2 Regularization
Tuning Alpha in L1 and L2 Regularization
AssemblyAI
32 Dropout Regularization
Dropout Regularization
AssemblyAI
33 What is GPT-3 and how does it work? | A Quick Review
What is GPT-3 and how does it work? | A Quick Review
AssemblyAI
34 Backpropagation For Neural Networks Explained | Deep Learning Tutorial
Backpropagation For Neural Networks Explained | Deep Learning Tutorial
AssemblyAI
35 Jupyter Notebooks Tutorial | How to use them & tips and tricks!
Jupyter Notebooks Tutorial | How to use them & tips and tricks!
AssemblyAI
36 Best Free Speech-To-Text APIs and Open Source Libraries
Best Free Speech-To-Text APIs and Open Source Libraries
AssemblyAI
37 Regularization - Early stopping
Regularization - Early stopping
AssemblyAI
38 Regularization - Data Augmentation
Regularization - Data Augmentation
AssemblyAI
39 Bias and Variance for Machine Learning | Deep Learning
Bias and Variance for Machine Learning | Deep Learning
AssemblyAI
40 Recurrent Neural Networks (RNNs) Explained - Deep Learning
Recurrent Neural Networks (RNNs) Explained - Deep Learning
AssemblyAI
41 What is BERT and how does it work? | A Quick Review
What is BERT and how does it work? | A Quick Review
AssemblyAI
42 Introduction to Transformers
Introduction to Transformers
AssemblyAI
43 Transformers | What is attention?
Transformers | What is attention?
AssemblyAI
44 Transformers | how attention relates to Transformers
Transformers | how attention relates to Transformers
AssemblyAI
45 Transformers | Basics of Transformers
Transformers | Basics of Transformers
AssemblyAI
46 Supervised Machine Learning Explained For Beginners
Supervised Machine Learning Explained For Beginners
AssemblyAI
47 Transformers | Basics of Transformers Encoders
Transformers | Basics of Transformers Encoders
AssemblyAI
48 Transformers | Basics of Transformers I/O
Transformers | Basics of Transformers I/O
AssemblyAI
49 How to evaluate ML models | Evaluation metrics for machine learning
How to evaluate ML models | Evaluation metrics for machine learning
AssemblyAI
50 Unsupervised Machine Learning Explained For Beginners
Unsupervised Machine Learning Explained For Beginners
AssemblyAI
51 Weight Initialization for Deep Feedforward Neural Networks
Weight Initialization for Deep Feedforward Neural Networks
AssemblyAI
52 Q-Learning Explained - Reinforcement Learning Tutorial
Q-Learning Explained - Reinforcement Learning Tutorial
AssemblyAI
53 Should You Use PyTorch or TensorFlow in 2022?
Should You Use PyTorch or TensorFlow in 2022?
AssemblyAI
54 What is Layer Normalization? | Deep Learning Fundamentals
What is Layer Normalization? | Deep Learning Fundamentals
AssemblyAI
55 I created a Python App to study FASTER
I created a Python App to study FASTER
AssemblyAI
56 How to create your FIRST NEURAL NETWORK with TensorFlow!
How to create your FIRST NEURAL NETWORK with TensorFlow!
AssemblyAI
57 Neural Networks Summary: All hyperparameters
Neural Networks Summary: All hyperparameters
AssemblyAI
58 Getting Started with OpenAI API and GPT-3 | Beginner Python Tutorial
Getting Started with OpenAI API and GPT-3 | Beginner Python Tutorial
AssemblyAI
59 Convert Speech-To-Text In Python in 60 seconds!
Convert Speech-To-Text In Python in 60 seconds!
AssemblyAI
60 Gradient Clipping for Neural Networks | Deep Learning Fundamentals
Gradient Clipping for Neural Networks | Deep Learning Fundamentals
AssemblyAI

This video teaches you how to use AssemblyAI's speech recognition API in Python to transcribe audio files, detect speakers, and customize output. You'll learn how to set up an AssemblyAI account, install the Python SDK, and use the API to transcribe audio files.

Key Takeaways
  1. Create an AssemblyAI account and get an API key
  2. Install the AssemblyAI Python SDK using pip
  3. Import the AssemblyAI SDK and set the API key
  4. Define the audio data to transcribe
  5. Create a transcriber object and call the transcribe function
  6. Customize the transcription output using configuration options
💡 AssemblyAI's API provides a range of customization options for transcription output, including punctuation, capitalization, and language detection.

Related Reads

Chapters (8)

Introduction
0:49 Simple transcription
3:10 Changing speech recognition model tier
4:32 Customizing the transcription
5:17 Automatic language detection
6:21 Getting speaker labels
7:08 Pricing and AssemblyAI Dashboard
7:31 Next video
Up next
Beyond the Bar: A Practical Guide to Your Early Legal Career
Steno
Watch →