I've Built an Android App With Google's New AI Gemini

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hey guys and welcome back to a new video Google just announced its new AI called Gemini and in this video you will learn what that is and how it relates to us Andro developers how we can now easily integrate AI into our apps and I will show you my AI sample app where you can upload a photo of your room and the AI will then suggest furniture that would fit well into that room so what is Gemini Google just announced this new AI Gemini here this is the the official website welcome to the Gemini era and it's marketed as the direct competitor of Chad GPT or the underlying AI behind that GPT 4 so if we scroll a little bit we directly see that Google Compares its AI Germany Ultra directly with GPT 4 and according to google their AI is quite more powerful here and in fact there are three different types of this new Gemini AI so if we keep on scrolling a little bit then we see we have Ultra Pro and Nano right now there's only the pro version publicly accessible which is kind of their standard model but in near future they will also publish their Ultra version which is special specialized for very complex tasks the Nano version however is optimized for on device usage so they will specifically put that new AI on new Google pixel devices so this is pretty cool so in future Google pixel devices right now with the Google pixel 8 Pro will come with an on device AI which you can use without any internet connection so in future our Android phones directly come with an integrated AI we can use for various tests so if you want to try out this Gemini AI you need to go to make A.G google.com where you will find this window you can just enter some prompts just like for chat GPT this is only available for the us right now so if you aren't from the US like I am then you need some form of VPN but after that that is really no problem as you can see here and we can just enter some kind of prompt for example give me a list in compose with 100 sample entries and if we click run then we get exactly that so it spits out a little bit less information than cat gbt so only what's relevant here as you can see but other than that the concept is really similar however that right here isn't really revolutionary what is the cool thing about this new AI is that it's really easy to integrate that in your own Android apps so you can simply click get API key here click okay and then you can get a new API key which you need to link with your Google Cloud console but after that you're ready to use that AI directly in your Android app and you will be surprised how easy it is to actually use that and build an AI app the API itself is free if you just use it for personal things so I think it only starts cost if you have more than 60 requests per second which you likely won't make if you're alone however you still have to give Google your payment information in order to activate that API so let's get to the exciting part and see how we can use that in code if you have an API key because for the latest Android studio version the preview for iguana there is actually already an integrated project wizard that already creates all the setup you need to work with the Gemini so if you have that preview version installed you can just go to file new new project and then you will see that there is a Gemini API startup project if you click next then they will ask for your API key and after that they will create everything you need in order to get started with integrating that Ai and this is the app that I have built with a Gemini in a matter of 30 to 60 minutes so quite fast for an AI app so we can pretty much select the picture of our interior design here and we then want the AI to give us suggestions for furniture we could put in that room which would fit well and that is what we want to do so I will upload a photo of my office room which gets compressed a little bit so it works with the file size limitations Gemini we can then click give me suggestions it will make the API call load a little moment and after that we hopefully get some good suggestions how to improve this room and as you can see the furniture should be modern and stylish and should complement the existing Decor a few pieces that would work well include a sofa a coffee table a rug or a few pieces of artwork to add personality I will leave it up to you if you would put a sofa there but that is the answer the AI gave us so I think overall this has comparable quality to An Answer chat GPT would give us but the big difference here about Gemini is how easily we can now integrate and use that AI directly in our code and I will really only focus on the Gemini relevant code here to show you how little is actually necessary in order to get such an AI response the first thing you need is you need to declare your generative model you need to declare the model name so you can either use Gemini Pro or Gemini Vision which also includes analyzing images or other types of files and you need to attach your API key which is Project wizard wholebody did for us but here in the UI we don't really need to do anything else other than creating our very basic layout the magic then happens in our main view model so here we just have a state a URI reader which just reads in the The Chosen image from the user as a bite array and a bit map and compresses that and if we then click on suggest so we want the AI model to suggests US furniture we pass in the model here and then the only thing we really need to do to get that answer is calling model that generate content then we can pass such a Content block and you can see how easy that is we just say hey we have an image that is part of this prompt here and we have a text that belongs to it so for the image we just pass our select image bit map which we read in before and for the text we say give me an image showing furniture that would fit well here and that is also what happened as you can see so it included an image here in text form because I didn't really read in that image from the response from the AI model but it is capable of also responding with images if we would now rephrase this prompt here for example to give me just suggestions for furniture that would fit well here we relaunch this take a look then in our app and execute the same request again then we really just get the answer and the details we asked for another cool thing is that it gives the answer in markdown format so with these asterisks so if you use a markdown par here you also get a consistent formating with that answer but this is now pretty much a gpta AI directly in your Android app which you can use with just a few lines of code as you can see so we could now adjust this completely flexibly we could go in here and ask okay what color is the floor what color is the floor if we relaunched this then we just adjusted our AI model or AI app rather if you click give me suggestions then we should hopefully get some form of accurate answer and you can see it answers with a single word but it's correct and of course you also don't need to have these hardcoded prompts here you could also keep this text flexible so the user can enter something the user can ask something about a certain image or so so overall this is really the only line of code you need in order to send such a prompt to the AI model and then you just call response or text to get the final text the final answer from that model if you care about images or other kinds of data that the model might have responded with you can also use this response to get more information here these candidates um we could then Loop over these and for each candidate we have the content we have different parts where we can also Loop over and each part then might consist of an image so we could try to convert that as an image um it might be a blob so some kind of bite array probably some kind of file or just as a text so this is how you can use such an AI now in your Android app what do I think of that well while I think Gemini is definitely improvable at the moment and also as a frequent gp4 user I don't really feel any any real difference to gp4 I actually think that gbd4 currently gives a bit better answers because it also explains more about you prompt but I think what will really make a big difference in future is that this Gemini AI will be directly integrated into your Android phone and since this will be an on device AI this will also be fast so I think Google can become very creative here in ways how you can use your phone smarter and more efficiently by just using Gemini but I would also love to know your opinion about this new AI have you already tried it what did you build with it let us know that in the comments and other than that thanks so much for watching I wish you a very nice rest of your week and see you back in the next video bye-bye
Info
Channel: Philipp Lackner
Views: 102,965
Rating: undefined out of 5
Keywords:
Id: i7PJwg0lrU0
Channel Id: undefined
Length: 8min 13sec (493 seconds)
Published: Wed Dec 27 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.