The GPT-4o: This Changes Everything

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello everyone welcome to introduction to open AI gbt for all model imagine an advanced AI that can understand and generate not only text but audio and video as well the gbt for o model where o stands for om reflect its capability for handling multiple types of input and output seamlessly whether you are working with a text image or audio the gb4 model is designed specifically to integrate all these modalities into a single coherent experience the gb4 O model respond to an audio input almost in real time which is similar to the human response time in a conversation on today's tutorial we are going to learn about all the features of the gbt for or model so let us get started before gbt 4 all users had to rely on multiple models to interact via text audio and video but now gbt 40 unifies all these capabilities into one powerful model this new approach means that all your content whether it is a written text or a spoken word or a visual content are being processed by the same neural network the gbt 4 o model has the same high intelligent as the gp4 TBO but it is much more efficient it generate deex two times faster and 50% cheaper now let's start building our first application using the gbt 4 o model [Music] all right let's get started and move to coding the first step is to prepare our Jupiter notebook so in this uh tutorial we have to install two libraries open a of course install or upgrade it if you have already installed open AI before and the next liary is the python d.v so we'll say the following pip install d d create Das quet open AI let's run the code next we want to install python Das do EnV to load the open API key from the environment variable now we want to load the open API key from the environment variable I have already generated an open API key and I stored it locally in my computer in the same location as this Jupiter notebook and a EnV file so we will say the following import OS to get access to the local files and then import open AI next from EnV import load find then we'll say load find to TMV and override equal to True next we'll say o os. inviron get open AI uncore API underscore key then we are going to print a message to the user in case the API key is loaded successfully we'll say os. Environ doget open AI uncore API uncore key and the condition is not none all right let's run the code and we get the result API key loaded equal to which means that the openi API key was loaded successfully now for testing our application let's create a small application with uh gbt 4 o here we'll say from open AI import open AI next we are going to create our client which is equal to open AI for model we are going to use GPT D4 all now we'll say response is equal to client do chat. completion do create for model we are going to use a model and for uh messages we are going to pass a dictionary of R the first one is going to be the system role and the content is you r a scii writer okay and the user content write a short story about life on Earth in the year 2,124 okay let's run the code sell now and it is done now let's print the response so we'll say print response do choices index Z message do content a great it generated a short story about the life on Earth in 100 years everything is working [Music] great in the first example we are going to use text and image as input to the gbt for all model for this example I'm going to use the Mona picture from Wikipedia I have already saved the image locally and in order to display the image we have to use the I python Library so if you don't have the I python Library you have to install it so we say pip install Qui I python next we'll say the following from I python do display import image and display image uncore pass is equal to Mona Lisa uncore Lisa jpic okay I have already saved this uh picture in the same location as this Jupiter notebook next we'll say display image image uncore pass and and wids I'm going to use let's say 600 equal 600 let's run the code and this is the image that we are going to send to gbt 4 model along with the text prompt as well okay please note that gbt 40 expect images encoded using base 64 to provide uh images to gbt 40 as base 64 encoded we have to do the following steps so we will say import base 64 and we are creating a function here in code underscore image and image underscore pass and then now we are going to open the image image uncore pass in read mode and binary as image underscore file we'll say here image underscore binary underscore data is equal to image file do read then we are going to return pce 64 dot P 64 encoded encode image underscore binary underscore data dot decode utf-8 let's run the code so this code snippet defined a function called in code uncore image that takes an image file like jbig or BNG and converts it into a base 64 string base 64 is a way of representing binary file like images or audio using only text character this is very important because gbt 4 o model expect images is to be provided in this P pce 64 format here we imported the pce 64 module from python standard Library this module provide us with tool for working with pay 64 encoding and decoding after that we open the file in read binary mode and here we read the entire content of the opened image file into a variable called image binary data this variable image binary data is now holds the row binary data representing the image after that here in Bas 64 64 in code image binary data this encodes the raw binary image data uh into a base 64 string the result is a bytes like object and then the decode utf8 decodes the base 64 bytes like object into a standard text that uses the utf8 character encoding and find finally we are returning the page 64 encoded string representation of the image all right now let's use this function and build our first application so we'll say base 64 uncore image is equal to in code image and we are going to pass the image pass that we Define above this one here the pass to our uh image okay now we will U create the system message system score message is equal you are an Art Expert next we will Define the prom which is equal to please describe this image now we will make a request to the chat completion API so we say response is equal to client. chat. completions do create and for model we are going to specify the model that we Define above which is gbt 40 for messages is going to be a dictionary of messages the first one for all we are going to use system and for Content it's going to be the system uh message next we are going to define the user message so we'll have here rooll user and here's the new part for the content we we are going to have multiple types okay the first type is the text so type text and the value of the text is the prompt that we Define define above the next type is the image so we'll have here Type image underscore URL and image uncore URL is URL which is going to be the data URI to imped the image directly within the request so this is where the basics for image variable we Define above with go so we'll say F data image/ jbig semicolon base 64 comma and here we are going to pass the base 64 image okay for temperature we are going to use zero temperature let me just scroll up a little bit so temperature is going to be equal to 0.0 all right let's run the code and make sure everything is working fine and it is done now let's print the response so we'll say print response dot choices index zero message do content and we get the response this image is a famous portrait paint known as Mona it was created by Italian artist Leonardo DCI okay so in this example we saw how we can now pass multiple input to the gbt for all and we pass a prompt as a text and an image and the image was was s locally in our computer all [Music] right in the second application here we are going to use an online image the user will ask a question about the historical significance of a specific image and we are going to use the Pyramid of Giza image from Wikipedia so we will say the following image uncore URL is equal to and this is the URL of the image and let us display it so we'll say display image image uncore URL and wids is equal to 400 let's run the code this is the image that we are going to send as input to gbt 40 okay let's now build the application so we'll say system uncore message is equal to you are an expert in an in ancient history and for promp is equal to what is the significance of this structure and in Egyptian history okay now we are going to make a request to the chat completion API and let me just copy and paste the code from here just to safe time so if we copy this code and here instead of passing the image as P 64 we are going to pass the image uncore URL okay after we get the result we'll say print response do choices index zero here and then message content let's run the code and make sure everything is working fine all right and we get the response so here instead of using a base 64 encoded image we use an image URL and it was successful it was it responded with a description of the image so that's it for now we have learned how to use the python API with gbt 4 om the new flagship model from open AI that can reason across different modalities and that's a wrap of our introductory dive into gbt for all model we have just scratched the surface of what is possible with this incredible AI model if you are looking for more advanced tutorial please let me know in the comment down below and don't forget to like subscribe and hit the notification Bell so that you don't miss any of my upcoming AI tutorials until next time keep exploring keep creating and let's push the boundaries of what's possible with AI
Info
Channel: Atef Ataya
Views: 13,364
Rating: undefined out of 5
Keywords: gpt-4o, gpt4o, ai, gpt-4o speech, gpt-4o voice, chat gptကိုမြန်မာလိုအသုံးပြုနည်း, openai, aiadvantage, gpt-4, artificial intelligence, chatgpt, chatbot, chatgpt4, chatgpt4o, chatgpt 4o, chatgpt 4o demo, chatgpt 4, chatgpt 4o presentation, chatgpt 4o tutorial, openai voice assistant, openai sora, openai api, openai assistant api, chatgpt tutorial, gpt 4o, gpt 4o free, gpt 4, gpt 4o demo, gpt 4 vision, gpt, gpt 4 free, gpt 5, gpt healthcare ipo, gpt store, gpt 4o voice, gpt online
Id: 6Yd1TJb1Yzs
Channel Id: undefined
Length: 17min 10sec (1030 seconds)
Published: Thu May 30 2024
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.