Create a Simple Assistant with OpenAI Tools
Learn to build a Python assistant using OpenAI Whisper, speech-to-text, and cookie.ts for easy audio transcription.
File
Create a personnal assistant in python with OpenAI GPT3, Open AI Whisper, Coqui TTS in 5 minutes
Added on 01/29/2025
Speakers
add Add new speaker

Speaker 1: Hey, welcome back. Today I'll present you a simple way of using OpenAI Whisperer, Speech-to-Text, OpenAI API text compilation and also cookie.ts to create this really, really simple assistant with a few lines of code in Python. So this is the result. Who is the first president of France?

Speaker 2: The first president of France was Charles de Gaulle, who served from 1959 to 1969.

Speaker 1: Yes, so that is a simple example. I can just add something else. I don't know what. Where is California located?

Speaker 2: California is located on the west coast of the United States between Oregon and the state of Baja, California in Mexico.

Speaker 1: Yeah, so perfect. Let me walk you through the code. So this Whisperer is the module that actually transcribed the audio to text. So I can pass it to the module. This sound device is how me record the audio. You can see it here. I think here is that recording. And this is supposed to write the file, this input file. I just use this to give a small amount of time between writing the file and giving the file to the module so it can transcribe it. So we start here by initializing this sound file and recording for 10 seconds. And when the recording is done, we save it in Input.wav, this file here. Where is California located? This is kind of the audio that we get from this module with all those noises and everything. The OpenAI Whisperer module is actually able to transcribe it and clearly identify the text. So we can see it here in the console here, where is California located. And then here I use the OpenAI key, it is in this file here. I just create a variable here called OpenAIKey where I save the key. And I use this completion module with this prompt. The prompt is actually on the website. I can also just give you the prompt if you need it. Just let me know in the comment. And yeah, and I get the response from this prompt here, the choice, I get the text from the... I get the first choice from the response, from the API response. And I just write it in the file using the speak method. It's actually really simple. Speech-text-to-speech, everything containing cookie, I did a long video about it on my channel so you can watch it. I'll put the link in the description. And it just basically write the text, it transcribe the text and transform this text into audio and write it in this output file that you have here.

Speaker 2: California is located on the west coast of the United States between Oregon and the state of Baja, California in Mexico.

Speaker 1: So after that, we have this play sound coming from sound file also. We can actually play sound with it. So we play this audio and then we wait until the audio is played and we start the program. So it's that easy as that. You can use it to do whatever you want and organize it better because this is really messy. But basically, this is how you can handle using Whisper for text-to-speech, for text-to-speech, not for speech-to-text, sorry, using OpenAI for text computation and using text-to-speech cookie DTS to read the response from your assistant. So this is, that is basically what I wanted to show you today. I hope you liked the video. Thank you and see you in the next video. Bye.

ai AI Insights
Summary

Generate a brief summary highlighting the main points of the transcript.

Generate
Title

Generate a concise and relevant title for the transcript based on the main themes and content discussed.

Generate
Keywords

Identify and highlight the key words or phrases most relevant to the content of the transcript.

Generate
Enter your query
Sentiments

Analyze the emotional tone of the transcript to determine whether the sentiment is positive, negative, or neutral.

Generate
Quizzes

Create interactive quizzes based on the content of the transcript to test comprehension or engage users.

Generate
{{ secondsToHumanTime(time) }}
Back
Forward
{{ Math.round(speed * 100) / 100 }}x
{{ secondsToHumanTime(duration) }}
close
New speaker
Add speaker
close
Edit speaker
Save changes
close
Share Transcript