How to Transcribe Multiple Languages | Spanish, German, Japanese and more!
15:22

How to Transcribe Multiple Languages | Spanish, German, Japanese and more!

AssemblyAI 15.08.2022 4 908 просмотров 66 лайков

Machine-readable: Markdown · JSON API · Site index

Поделиться Telegram VK Бот
Транскрипт Скачать .md
Анализ с AI
Описание видео
In this video, let's learn how to transcribe audio and video files that are in languages other than English. We will learn to achieve this both by providing the language of the audio file to the transcriber or by having the transcriber automatically detect the language of the audio file. The languages that are supported right now are: English and its different accents such as US, UK, AUS or Global, German, Dutch, Spanish, Portuguese, Japanese, Hindi, French, and Italian. But support for more languages is on the way! Find out more here: https://www.assemblyai.com/docs/#supported-languages Get your AssemblyAI API key here: https://www.assemblyai.com/?utm_source=youtube&utm_medium=referral&utm_campaign=yt_mis_32 ▬▬▬▬▬▬▬▬▬▬▬▬ CONNECT ▬▬▬▬▬▬▬▬▬▬▬▬ 🖥️ Website: https://www.assemblyai.com 🐦 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

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

<Untitled Chapter 1>

hey and welcome today i'm going to show you how to transcribe audio or video files that are not in english assembly ai follows a bunch of languages including spanish german dutch hindi japanese and more and we're always working on new languages to include on our api and i'm going to show you two ways of doing it with assembly ai's api the first one by specifying the language that you're passing the audio file in and the other one by using assembly ai's auto language detection feature so let's get started so there are a couple of steps to this project as i've written here first we need to set up a connection to assembly ai then we need to upload the file that we have in our local file system to assembly ai if you have a url if you have your audio or video file uploaded somewhere on the internet you can also just pass this url too uh then we will start the transcription and then we will do something to receive the transcription all right so let's get started the first thing that i need to do is import the

Import the Requests Library

requests library the suggestions i have here is basic by the way github co-pilot so if you want to if you're curious about why i'm getting suggestions all the time uh all right so we're going to use a request library in these library the first thing that i need to do to send the audio file that i have locally to assembly ai is to send a post request so i will start a post request and then i'm going to have to fill this in with some things the first thing of course is the upload endpoint of assembly ai and let's create an upload endpoint variable and the next thing that i need is the headers the headers are going to include my authentication key so i also need to create the headers if you do not yet have your assembly ai api key it's very easy to get all you need to do is go to assemblyai. com or you can use the link in the description below and create a free account by going through the get started button and once you have your free account you can go and click here to get your api key and all you have to do here then for ultimate authorization which is paste it here and the last thing that i need in this post request is the data of course and this data because we are reading it from our local system we're going to need a

Read File Function

read file function this is a function that we use in some of our tutorials before too it's basically you give a give it a certain chunk size and it reads in chunks reads this audio or video file in chunks so that it can be uploaded to assembly ai's servers alright so i also need to pass the file name to it so what i want to do in this project is to get the file name from the command line arguments so for that i need to import system and then i will get a argument list the first argument i'm going to get will be the file name and the second language name so which language we want to do the transcription in all right list two all right once i get the file name i can also pass it with the read file function and by this way we will be uploading our audio file to assembly ai so i will just copy and paste this code where it belongs let's see here we set up a connection with assembly ai with the upload endpoint and headers and here we upload the file to assembly ai the next thing that we want to do is to start a transcription but to start the transcription we need to get the url of where this audio or video file has been uploaded to so i'll just save this as a response call it the upload response and in this upload response i can get the audio url ah there you go nobody gives it to me upload response json url but i'm not sure if this was called url or audio so let's run this once and see what the upload response looks like so that i know i'm calling the correct part of the json response let's comment this out so let's run this all right all i have to do now is to go into the transcription folder and then run my transcription script i will pass the german audio to it for now we will not get a transcription yet but just uh to try it out yes i get a response my audio file has been uploaded and the field is upload url so that's good to know it's not just url but it is upload url and this way i now have the autourl of this file on assembly ai servers so now

Start a Transcription

it's time to start a transcription for that i'm going to again send a request again a post request this time to assembly ai's transcription endpoint so i will note it down here again and point and that will be the first thing that i'm going to pass to this post request and then the next thing again going to be headers and i already have my headers here and lastly i need to pass some information under the variable json so let's create that my json information my information json format that i'm passing the first thing is the order url of course w already parsed from the upload response and the next thing that i want to do in this specific one here is where we can also specify the audio intelligence features that we want for example sentiment analysis content moderation but this time what i want to do is i want to pass a specific language that i want this transcription to be in so that's why i'm going to say language code you can hard code it here of course but we already got this information from the user so i'm just going to pass language uh you can see what kind of codes language codes that you can use in assembly ai's documentation here it is i will as i said leave a link to it below this video so you can go check it out here but so far the supported languages are different types of english spanish french german italian portuguese dutch hindi and japanese we also have some other ones under construction so far so let's try this out we pass the json information and next what we want to do of course is to get and read the response to this so i'm going to say call this transcription response but this of course will not be the transcription immediately because transcriptions take a little bit of time that's why we're going to get an name or id for this transcription and then we're going to pull the assembly ai servers to get this transcription back so for that i'm going to need to extract an id but let's print this transcription response to see what it looks like all right our transcription has been started this is the response we got from the upload and this is a response we got by starting the transcription how we're going to find this transcription is through this id so i'm going to have to get that in my code uh i will call this the transcript id and that would be transcriptionresponse. json not in there but next to it id going to combine the transcription endpoint with this transcription id in order to create a new poll endpoint and that would be called the polling endpoint this polling endpoint is going to be the place where i'm going to ask to see if my transcription has been done and that's going to happen under the received transcription section what we're going to do is basically keep pulling assembly ai to see if the transcription is done until it is done uh one thing that i want to fix here before we move on of course is that we need a little slash here all right so in here what i'm going to do is again send the request but this time i get requests because i'm not sending anything i'm only asking for information i'm going to send this request to the polling endpoint and i'm going to have to include my headers again we're going to get a response from this request of course and inside this request inside this response we're going to have something called the status this status is either going to be submitted processing uh or completed if it errors out of course it could also be error um but if basically what we're going to wait is completed so i will call this the status and if status is completed we're going to take the transcription and write it in a file and if it's uh not failed good guess github copilot if it's error then we can print the transcription has errored out and then break this loop we have to break it of course if it succeeds too but if anything else happens if it did not error out or complete i can just print what the status is and then wait for two seconds maybe i need to import time to here and then continue all right so let's see what we're going to do once it is completed uh what i want to do is basically save

Save the Transcription in a File

the transcription in a file let's see if copilot can come up with the what to do here yes this sounds good we will create a transcription. txt and we're going to write uh the transcription from the polling response inside this txt but it is not called transcript it's the only difference it is called text and we will get it from the polling response all right this looks good one thing that i want to add here is i don't only want to call the file transcription i want to call it the name of the language and then underscore transcription all right let's run this with our german audio file and see what we get python transcription german audio and i will pass it the de language code all right it looks like our transcription is done uh it processed for a little bit and then it was done so let's hear it out and see if everything went well so this is the transcription that was produced and i will also play the german audio all right it all looks good to me now so here i also have a dutch audio model these are both pieces of audio that talk about the black hole by the way if you ever wondering what they're about i want to show you how to transcribe the

How To Transcribe the Dutch Audio without Specifying a Language

dutch audio without specifying a language and that's actually quite simple to do once you have this code what we need to do here is a language code so we were specifying the language code here right instead what we're going to say is language underscore detection and we're going to set this to true so the language we're going to get from the command line arguments is only going to help us create uh where is it um the transcription files uh name so let's run this with the dutch audio and see what we get and now the transcription is done let's see if it worked or not here we have the nl transcription text i will make it a bit bigger so that we can see it and i will also start playing the dutch audio all right it looks like this text is in dutch uh and it looks like it is quite uh correct so uh one thing that you need to keep in mind though when you're using the auto language detection feature is that your audio or video file needs to be at least 50 seconds long there needs to be 50 seconds of talking for the model to be able to detect it automatically detect the dominant language automatically in your file but that's it for transcribing audio or video files in languages other than english i hope this was all clear for you if you have any questions don't forget to leave a comment below if you want to follow along do it yourself you can go grab your free api token from assembly ai either by going to assemblyai. com or by using the link in the description thanks for watching and i will see you in the next video

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

Ctrl+V

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

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

Подписаться

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

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