Python Speech Recognition in 5 Minutes

AssemblyAI · Intermediate ·🔍 RAG & Vector Search ·4y ago

Key Takeaways

This video teaches Python speech recognition using AssemblyAI's API

Full Transcript

what's up y'all today i'm going to show you how to use python to turn an mp3 file into a text like this in under 25 lines of code we're going to be following this blog so let's get right into it all right so you'll need an assembly ai api key which you can get by going to assemblyai.com and checking out signing up in the upper right hand corner you'll need an mp3 file and jupyter notebook so uh to install jupiter notebook you can pip install notebook or through vs code and then you can open it up with jupyter notebook and before we get started i want to just point out there's going to be an off key line but i'm going to skip because i have already imported my hotkey so let's get started we're going to import requests we're going to be sending htcp requests um so then we'll make a headers which will be uh the authorization we'll need an authorization uh and this will be the auth key that we um got from assembly ai and then we'll need the content type which will oops which will be application slash json um and then we'll create a generator function that will um yield the bytes of our mp3 file so with open file name maria's bytes uh while true data is going to be equal to file.read and we're going to give it a pretty big chunk size because we're reading an audio file uh if not data break break and then we're going to yield our data in each while loop all right now we're going to send a request to assembly ai's upload endpoint so their upload endpoint is an endpoint which you can upload an mp3 file to and it will temporarily host it for you and so we'll be doing this to upload an mp3 file and then send that link as the audio url to the transcription request all right so this upload request uh upload response we're going to send a post request to https colon slash api.assemblyai.com v2 upload headers is going to equal our headers and then the data is going to equal read file and this is where you need the mp3 file so this is my mp3 file all right now let's look at our upload response cool so this tells us where our file was uploaded now we're going to um make that transcript request as i was saying well i should have just kept that but uh whatever um so audio url and that's going to be this okay so what we're going to do is we're going to send this transcript request to a transcript endpoint i'm going to send a post request and this is the endpoint for assembly ai's api that you send the audio file to so that you can get a transcription of it uh headers json equals transcript request right now let's take a look at our response cool so you know you can see in our response we got the id so we're going to need this we're going to need this in a moment um the language muscle model model acoustic model we can see that it's cubes and then text and words so this is what we're going to be looking at later we're going to get the text and then the words is going to show us the confidence score of each word and when it was said so let's copy this id because we're about to send a get request to the transcript endpoint of that id so that we can get this json response back again so polling response is equal to um requests.get accps um assembly v2 slash transcript slash there we go and we'll need to send the headers and we'll take a look at what's taking a while to send okay so okay there we go polling pullingresponse.json and we'll see what it looks like and okay so we're already done um we're already done transcribing uh usually you can expect about 30 of the length of your uh mp3 um so this is pretty quick because our v3 file is like five minutes i think um so yeah you can see the text and then the words right text the confidence of it and um when it was when it was when it was said basically so yeah if you like that like and subscribe and i'll see you later

Original Description

Python Speech Recognition in 5 Minutes using AssemblyAI's API. You can get your free API key by signing up at AssemblyAI.com You can find the original blog post on how to do speech recognition in Python in under 25 lines here - https://www.assemblyai.com/blog/python-speech-recognition-in-under-25-lines-of-code
Watch on YouTube ↗ (saves to browser)
Sign in to unlock AI tutor explanation · ⚡30

Playlist

Uploads from AssemblyAI · AssemblyAI · 1 of 60

← Previous Next →
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

Related AI Lessons

Why you shouldn’t search your documents directly with AI
Learn why directly searching documents with AI can be inefficient and how retrieval-augmented systems can improve the process
Medium · Programming
Your AI Keeps Making Things Up. RAG Is How You Make It Use Real Facts Instead.
Learn how to use RAG to make your AI provide accurate answers based on real facts instead of making things up
Medium · RAG
Evaluation Metrics for RAG: Measure Retrieval, Generation, and End-to-End Quality With Numbers That…
Learn to evaluate RAG models using metrics that measure retrieval, generation, and end-to-end quality
Medium · AI
Evaluation Metrics for RAG: Measure Retrieval, Generation, and End-to-End Quality With Numbers That…
Learn to evaluate RAG models using metrics that measure retrieval, generation, and end-to-end quality
Medium · Data Science
Up next
RRF vs DBSF with Qdrant: Hybrid Retrieval Fusion for RAG in Python
Professor Py: AI Engineering
Watch →