Add speech recognition to your Streamlit apps in 5 minutes
6:36

Add speech recognition to your Streamlit apps in 5 minutes

AssemblyAI 22.11.2021 14 523 просмотров 194 лайков

Machine-readable: Markdown · JSON API · Site index

Поделиться Telegram VK Бот
Транскрипт Скачать .md
Анализ с AI
Описание видео
In this new series, we will learn how to integrate AssemblyAI with different technologies in each video. In this video, we are looking into a Streamlit app. We learn how to quickly bring in transcription into a pre-made app thanks to AssemblyAI's easy-to-use API. Get your free speech-to-text API token 👇 https://www.assemblyai.com/?utm_source=youtube&utm_medium=referral&utm_campaign=yt_mis_7 It only takes 5 minutes and a couple of lines of code to have the transcription of an audio file generated. Let's get started!

Оглавление (4 сегментов)

<Untitled Chapter 1>

assembly ai is very easy and quick to integrate into your existing apps so today i'm going to show you how to integrate assembly ai to an existing streamlet app in under 10 minutes here's what the app looks like right now and here's what it will look like once we're done with it we are going to use assembly ai's api to transcribe youtube videos and show them in this stream of application assembly ai is a company that is developing a state-of-the-art speech to text api if you also want to use this api and for free go and grab your free api token using the link in the description all right so let's get started what i have so far is a very simple application just one text input gives me user can give me the youtube link and i display the youtube video here but what i also do is download to audio and save it somewhere on my local file system what i want to do from now on is to include assembly ai so the first thing that i want to do is to specify the end points that i'm going to use there are two endpoints in this project the upload endpoint and the transcript endpoint this is this is a transcript endpoint after i've done this the next thing i want to do is to create a header

Create a Header

and this header will be used for authentication so i will create the header of course i do not have my authentication key yet so i need to go get it from assembly ai so let's do that it's very easy you just need to create an assembly ai account and once you sign in you will be welcomed with your api key i can just click to copy this one and i create a new file and that's it of course i also need to import it here all right so now my authentication is done the next thing that i want to do is to create a function that will upload the audio file that i have locally to assembly ai and then well that will also start a transcription job and i will call this one start transcription all right so the first thing that i want

Upload the Audio File to Assembly Ai

to do is to upload the audio file to assembly ai for that i'm going to send a post request to the upload endpoint that was specified earlier using the headers for authentication and also using the save location that i saved in the session state of streamlet to access the file and upload it there and as a result of this upload request i'm going to get a response in this response i will be able to see the url where this audio file has been uploaded to and using this url i will be able to start the transcription job to start a

Start a Transcription Job

transcription job first step is to create a dictionary specifying where assembly i can find this audio file and whether i want this audio file to be categorized or not but for now i don't want that and later to create the transcription job or to start a transcription job very simply very similar to the upload request that we sent we're going to send another request passing it the dictionary variable that we just created and the endpoint and the headers for authentication as a response to this request what we get in return is a response in this response we have an id and this id is basically the id of the transcription job and using the endpoint that we have and this id we can create a polling endpoint this polling endpoint is something we're going to use to ask assembly ai how the progress on the transcription is going so for that i'm just going to return the polling endpoint from this function so that i can check on it later all right now that the function is ready it is time to actually use this function so for that i'm going to call this function start transcription and as we know we are getting a polling endpoint from it what i want to do now is to use this polling endpoint to check if how about how the transcription is going so how you do that is by sending a get request in this get request i only need to specify the polling endpoint and the headers for authentication in the polling response i have something called the status tells me if it has only been queued it's if it's processing or if it's been completed already so that's what i want to know from this response i can print this one for example to know how it's going and once it's done we can get the text that is the final text so once it's completed once the status is completed it also gives us a text so that's the complete transcription for this audio file i'm going to call this the transcription and i also want to display it once it's done but actually just by running it once we will not be able to get the text because it needs to process for a little bit so you might need to ask assembly ai how the progress is going a couple of times so for that one i will very simply use a while loop uh if you remember we created a session state well i created it before so at first it is submitted so i'm going to update the session state using the state information that we get from the polling response and i will also use this in the while loop and i will say as long as the status is not completed keep asking assembly ai how it's going and that's it now we have integrated assembly ai into our app so let's go and see how it actually looks yeah and here it is now it worked and this is one of my favorite clips from the series called the office uh it's just michael doing improvisation but either way it looks like our application is working and that's it in less than 10 minutes we are done with integrating assembly ai into our application if you like this video don't forget to give it a like and subscribe so that you will be one of the first people to know when we publish a new video if you have any questions or comments about this video definitely leave a comment i would love to see those to try this out yourself go and grab your free api token from assembly ai using the link in the description but for now have a nice day and i'll see you around

Другие видео автора — AssemblyAI

Ctrl+V

Экстракт Знаний в Telegram

Экстракты и дистилляты из лучших YouTube-каналов — сразу после публикации.

Подписаться

Дайджест Экстрактов

Лучшие методички за неделю — каждый понедельник