Robin and Mazen are joined by Gant Laborde to explore the world of on-device AI in React Native. They discuss ways of integrating AI on mobile devices, as well as how Infinite Red’s ML Kit simplifies the process—enabling developers to add advanced AI features with ease.
This episode is brought to you by Infinite Red! Infinite Red is an expert React Native consultancy located in the USA. With nearly a decade of React Native experience and deep roots in the React Native community (hosts of Chain React and the React Native Newsletter, core React Native contributors, creators of Ignite and Reactotron, and much, much more), Infinite Red is the best choice for helping you build and deploy your next React Native app.
Show Notes
Connect With Us!
Todd Werth:
Welcome back to React Native Radio podcast,
Todd Werth:
Brought
Todd Werth:
To you by Money episode 3 0 5 on device AI and react native with Gantt Leor.
Hey, it's me again. Before we start the episode, I wanted to let you know that we're hiring here at Infinite Red. My name is Todd, I'm the CEO and I'm also the guy who does the silly intros for this podcast. We're looking for a few senior React native engineers To join our team here full time, you have to be in the USA. You have to be senior level and react native. You have to be kind, willing to work with clients and it really helps if you enjoy silliness as I'm here, there's lots of silliness, hopefully good silliness, but we're fully remote, always have been, always will be. We all have families and or personal lives, so we strictly stick to a healthy work life balance. If you're interested, go to Careers dot Infinite Red and fill out our form. Okay, back to our episode. Thank you so much for listening.
Robin Heinze:
Hello everybody. Welcome back to React Native Radio. You've probably noticed that I do not sound like Jamon. Who's
Mazen Chami:
That? Jamon.
Robin Heinze:
It's because I'm not Jamon.
Gant Laborde:
What?
Robin Heinze:
Crazy. I know Jamon is out. I feel like he won't be mad if I tell the audience this, but
Gant Laborde:
I feel like he will do it anyway.
Robin Heinze:
Jamon is out dealing with head lice, which has befall his household and so I'm your host for the day. One of the things we do when we prepare an episode is come up with an adjective to describe the hosts, which a lot of you love about our episodes and since the topic today involves ai, I decided to have chat GPT Invent an adjective and it was quite the process coming up with something. At first it was just like, here I'm going to smush two words together and it came up with radiant tastic.
Mazen Chami:
Radiant like radiating Fantastic.
Gant Laborde:
Yeah, it's an alternative to degree Astic. You use radiant plastics,
Robin Heinze:
Radiant and fantastic. It came up with spark cent
Mazen Chami:
Harry Potter. Okay,
Robin Heinze:
Harry Potter, spark, cent spark. And then I was like, no, no, no. I don't want you to just smush two words together. I want you to actually come up with a new word and it came up with luminal, which Jed, our producer said sounded like a pharmaceutical and I buy it, I buy it.
Mazen Chami:
Wait until you hear the side effects that come with it.
Robin Heinze:
It came up biv, which I dunno, didn't sound that cool to me.
Mazen Chami:
What was its definition for riv?
Robin Heinze:
Someone who exudes a natural and effortless brilliance, inspiring those around them with their creativity, intelligence, and positive spirit. I don't know where it got that it,
Mazen Chami:
I think it mushed two words there. It sounds like brave and courageous. I don't know, maybe.
Robin Heinze:
I don't know. It was getting better so it didn't listen to, but you'll hear the word that we ultimately chose in just a second, so I better get on with our introductions. I am Robin Hines, of course, I'm the director of engineering at Infinite Red. I'm located west of Portland, Oregon with my husband and my two kids and I've specialized in React native for the past seven years, I think seven years now, and I'm joined by my drum roll. Let's
Gant Laborde:
Hear it.
Robin Heinze:
Vol. Cohost, molin. Belligerent.
Mazen Chami:
Belligerent cohost.
Gant Laborde:
What was that?
Robin Heinze:
Ous? I mean it's a made up word so it's also a made up pronunciation. So I'm made that vellus, V-L-I-T-U-O-U-S.
Gant Laborde:
What's the origin of the word? Can you use, could you use it in a sentence
Mazen Chami:
Other than
Robin Heinze:
Chat? GPT is the origin
Gant Laborde:
2024? Is this Greek or Latin? We need to know.
Robin Heinze:
I wonder what the first AI created word in the Oxford English dictionary will be. Oh, good call. Maybe it will be Ous possessing an innate charm and grace that naturally draws others in. I dunno. I think we should submit it.
Mazen Chami:
I think we should
Gant Laborde:
Do it.
Robin Heinze:
You've already heard his voice but now you'll hear his name. We also have a lovely guest, Gantt Leor, who is our CIO, extraordinary. He lives in New Orleans, Louisiana with his wife and his little daughter and he's an AI enthusiast and author of the O'Reilly book Learning TensorFlow Do js, which is a good book. You should pick it up if you don't have it already.
Gant Laborde:
Yeah, you could pick it up at any O'Reilly Auto parts store. Yeah, they hate that at that publisher, right? They're just like, we are popular but we don't have a jingle.
Robin Heinze:
You missed the boat on that one. Do we have a jingle? We should have one.
Gant Laborde:
An infinite red React Native coat. He right.
Robin Heinze:
We should have, should have Derek ride us a jingle for real
Gant Laborde:
Though. Or I could have AI write us a jingle if you'd like.
Robin Heinze:
Ooh, I love that. Do it.
Gant Laborde:
Consider done.
Robin Heinze:
Next episode, listen for it. Right. Without further ado, our topic for today is on device AI in React Native with of course, Gantt Leor. A lot of people know us for our React native work of course, but they may not know that we were also extremely early to ai and by we, I mean Gantt, who's been doing this for how many years now, Gantt, when you first picked up AI machine learning
Gant Laborde:
Over five years. Over five years.
Robin Heinze:
So yeah, we were doing it before it was cool
Gant Laborde:
Actually like seven years.
Robin Heinze:
Seven years. Where? Where's
Gant Laborde:
Time going?
Robin Heinze:
Stop making up numbers. Kent,
Gant Laborde:
What are you going to do? Fact, check me, I'm hallucinating here.
Mazen Chami:
It sounds like the episode where you all had Todd on and he was going to make up random numbers, percentages and stuff.
Robin Heinze:
Doesn't everybody do that?
Mazen Chami:
I will say I've had people reach out to me in my community and networking that I do in mentoring and they've actually asked me to help put them in touch with Gantt because they've said while researching AI and React, react native name's come up. So Gantt is the go-to, and I did actually get to work with Gantt for a little stint. Oh yeah. Preparing for a potential AI client that we had and that was really cool.
Gant Laborde:
Yeah, I really, really enjoy ai.
Mazen Chami:
Yeah. What's spark your interest in AI and got you into ai? Again,
Gant Laborde:
Dude, I kind of say there's a new influx of people into technology and I don't know what their aha moment is, but there's always been things that computers did. I was just like, oh, that's so cool. I have to make that happen for me. I'm so old. It was just making the computer actually say hi. I was just like, oh yeah, this is great. Hello world was my wow, this is amazing
Robin Heinze:
Moment. I feel like a lot of everyone had their hello world moment, like, oh my gosh, I just did something that made the computer talk to me. How cool is that
Mazen Chami:
If you're a developer and you type hello without the trailing W, you are not a real developer. That started with Hello World, in my opinion, hello W is always how I write. Hello. I've sent Hello doubling to my wife a couple times and she's been like, W question mark. I'm like, forget it. Long story.
Gant Laborde:
It
Mazen Chami:
Goes back when I was 12.
Gant Laborde:
If you think about it that's think about the first time you made JavaScript do a popup or you made web do something and the first time you made a phone do something. It was just like this amazing moment where you've seen technology do something and you're like, this is where the world is going. And I had that moment with AI and that was just it. I couldn't do it anymore. I was like, oh my God, I could do this. This is where everything's going. So back in 2017, I went full force into ai,
Robin Heinze:
But nobody else had realized it yet. So you were just like the lone wolf in the desert being like, this is cool. Everybody pay attention.
Gant Laborde:
I would love to say that that was the case, but I think the world kind of woke up to AI in 2012 is when there was just this ability to do things at human-like intelligence with near human capabilities and people said, wow. And then they got closer, closer and then surpassed human-like capabilities. I was probably late to that game,
Robin Heinze:
But which is so crazy. I was in my senior year of college in 2012 and one of my professors was really pushing this machine learning stuff and I was like, it was a chore for me. It was difficult. And I was like, what? It didn't, hadn't the spark hadn't been like, oh, this is going to be the future of the world. I should probably pay attention and if I could go back in time, I would work harder on understanding it and maybe go into the field when I had the chance.
Gant Laborde:
That's this kind of thing, but as long as you have the aha moment, I feel like it doesn't matter. There's always that saying, when should you start saving for your 401k? The best day was yesterday. The second best day is today. We can only learn from our past and kind of go forward. And then to me, from my past, I've seen technology move forward. I've seen mobile apps become all the rage. I was like, oh, I should have learned how to code mobile apps to catch that whole wave. I was way ahead on web, I was way behind on mobile, but I've obviously caught up and way on top of React native. Just as soon as React native came out, I was one of the first people contributing back to it. I was in the top a hundred contributors to React native for the open source repository, building ignite, things like that. And I think what's great about it is you just start to see these bubbles start to show up and people start to say, okay, this might be something. I was like, I know it's going to be something. I missed that train three or four times and now I'm catching them.
Robin Heinze:
That's awesome. So let's zoom out a little bit. Big picture. Obviously if you're awake, you've realized that AI is everywhere and it's kind of wowing people right now and becoming a part of products all over the place. Products that used to be something else are now AI powered. It's become a bit of a marketing thing, but what are y'all's favorite uses of AI in apps that you use regularly? Moz, and I'll start with you.
Mazen Chami:
Yeah, so not sure if you've all heard of the app Wavelength. It's a pretty cool one because what it does is it brings AI into the chat. That's basically what it does. So for example, my wife and I have a chat group where we only use it to help us with a meal plan. So we'll say at ai, here's what we have in the fridge, give me three dishes and then it'll give you three dishes and then you'll be alright, ai, can you dig into what this dish, give me a couple recipes for this dish and we kind of expand it that way. We also use it for toddler game ideas. So like, Hey, at ai, we saw this game online, what do I need to do to build this? If it's something, get some wood palettes and stuff like that. And actually I use it with a friend for sports. It's funny, now we have our iMessage chat going, but when it comes time, when we ask a question, my friend the other day was like, who won the March Madness five years ago? And right away I switched over to Wavelength. I asked the AI group and he put in the chat LOL. He's like, I should have just done it in here in the first place
Robin Heinze:
Type of thing. That's really cool. I should try that with my husband. We meal plan, our meal planning strategy right now is just sending each other Instagram reels with recipes in them. Same back and forth forever. And then there's a recipe I want from three months ago and I'm never going to find this again.
Mazen Chami:
Yeah, it's the same. Usually that recipe starts on Instagram reel. We pull out the recipe, we put it in the wave wavelength, and then we ask wavelength like, Hey, we don't have these ingredients. What are replacements online that you find, for example? And they do have a Mac app. It's only iOS specific, so it's iOS, sorry, iPhone, iPad, Mac for now.
Robin Heinze:
That's really cool. I'm actually going to go and try that, so thank you. It's pretty cool. Again, what about you
Gant Laborde:
Inside products? I am really loving the fact that people are starting to bring recommendation engines into LLMs, which gives you sort of a virtual assistant slash concierge experience. So I love that Spotify now has a DJ inside of it and before the DJ plays some songs they tell you, Hey, these are some new songs and some old songs from a playlist or this or that, and it's kind of nice. I have my own personal DJ who's figuring out songs and playing them for me, and if I fast forward a song, I know that the DJ gets a little bit smarter. If I pass on it, they're going to go ahead and improve it. So inside products is great, but also outside of that new products, just doing generative AI is always magical. One of my favorite things now is generating songs with a suno.com. So like I said, I can get a jingle for us in no time.
Robin Heinze:
That would be so cool if I had to pick a favorite from recently. So we've been testing out new video chatting app called Multi Recently, which is really great for screen sharing and pairing and stuff, but their AI features are pretty next level and after you end a meeting, it gives you this AI summary. So if you weren't taking notes during the meeting, it's really good at parsing out what action items were. It's very good. Either stated explicitly or even kind of implied and pulling out the key themes of the meeting and just creating this nice little summary, really powerful stuff. Unfortunately, just yesterday they announced that they have been sold to OpenAI and they're shutting down the app.
Gant Laborde:
Oh no. Oh, by the way, Robin, I have a piece of cake that you can't eat. Would you like to hear about it?
Robin Heinze:
So that's a pretty useless recommendation, but hopefully the tech will emerge. If OpenAI is buying the company, then hopefully the tech will still emerge somewhere else. But yeah, that's been my favorite recently. Unfortunately
Mazen Chami:
It's a very good tool for sure.
Robin Heinze:
You can still use it for another month, so
Mazen Chami:
Yeah, use it, get really into it and then all of a sudden it's gone. So sorry. Hopefully, I hope OpenAI does bring it back in some capacity. Maybe they'll use it to expand Chad GT's features and then eventually grow on it in some way or form. Well on that note, Kent, and what you mentioned about LLMs LLMs that are used to power chat GPT for example, they're huge, they're humongous. Can you give us some insight into that and would that even be possible to run on a device mobile device?
Gant Laborde:
Yeah, absolutely. So what's great about this is people measure these things by parameters and if you've ever had somebody break open a neural network for you, you see all these neurons or these nodes and then between those you see these weights and biases, those weights and biases are the magic numbers that make that model work. What's funny is that a model starts at a certain size and so when you start an LLMA large language model, you start it huge like a giant, giant, giant file, and then all it does is just tune those billions upon billions of parameters between all those nodes to become the numbers that make the magic happen. If you take an untrained model and then ask it what to do, it'll spit out gibberish. I've actually built a couple websites showing how a model before it's trained just basically is randomness generator and then because it was weighted with random numbers and then eventually through a little bit of calculus, it kind of figures out how to make those things better and better and better and it has these huge floating point numbers for these values.
Well, what happens is we're trying to figure out what nodes after it's been trained are the ones that are actually making the difference happen. Can you group some together and still keep the accuracy high? And then here's another thing, quantizing models is another cool thing where you're instead of taking these huge floating point numbers, can you bring them down to eights or something like that? Can you just make the numbers take up less space and memory and still get the model to go ahead and give you those valid calculations? So when you're doing all these things, we're bringing the size of the model down and we're finding out that there's entirely sparse networks of these neurons that could be compressed in some way. It's just that we haven't figured out a lot of those things. Secondly, followed by the fact that we are continuing to make AI on device chips, so all of us have phones with AI chips on them, and what that does is that allows them to run those linear algebra, those inferences better, but those things could do all kinds of stuff.
You could actually probably eventually even have an LLM chip on there that becomes hydrated with the mini LLM that needs to be there. I could see that in the future we're going to see the same kind of gravitation towards AI on devices that we've seen with every other AI on device. We've seen, for instance, voice to text used to be a server only option where you would go ahead and you'd speak directly into your phone, it would send that off to the server and then come back with a text that was necessary for it. Then apple's like guess what? We've moved a lot of this to on device and then so when you say voice to text on your phone now you can see it actively filling out the information, but then the low confidence words, the ones where it has the least confidence, it sends those off to a much larger server and comes back. So if you're an old dude like me who loves voice to text and I know I'm dating myself,
Robin Heinze:
There's an cutoff where immediately you start doing all of your texts out loud. It's so useful. I'm
Gant Laborde:
Sorry dude, I get it. You could swipe super
Robin Heinze:
Fast. I'll be there in a minute period.
Gant Laborde:
Yeah, well I think it's a little bit of that and getting bigger phones, to be honest, I have long fingers, but I have the giant Pro Max holding that's a two handed phone at any given moment I could voice the text with one hand and so what happens is I hit the button, I say, it says the sentences out there, you could see what's going on device, it sends the low confidence patches out to the server, comes back with these impressive fixing. So what we'll start to see is just in anything I'm going to say, remember history doesn't exactly repeat itself, but sure as hell rhymes. We're going to get this moment where we're going to see this client server architecture between on device and server for LLMs where we will have LLM chips. We'll have LM on device technology where it'll figure out where you'll have sort of, can I handle this here and if not, where do I send it off to come back and kind of give you the least amount of network traffic and the most capable offline capability at the same time.
Mazen Chami:
You talked a lot about it being on the device but then also sending it to the cloud. What's the benefit of, obviously other than data and internet connectivity, which I feel like at this point almost everybody, almost in quotes, almost everybody has, what are the benefits of even having it on the device in the first place? If you can just send it to the cloud and just get that actual really high confidence back instead of burning a hole in your hand from holding your phone in the battery heating through because it's doing so much processing on device, what's the benefit?
Gant Laborde:
Well, that round trip doesn't work for some things. For instance, let's say I was doing AI vision. If I'm trying to go ahead and do AI vision, sure, I could take a picture of a screw, have it go off to the server and I want to find the exact screw for that. I want to know exactly what to buy, hit me with the best thing you could possibly have, bring that back. That's an opportunity where you say, please give me the best, most badass model on the cloud and then just bring it back to me. You see this also with services and such, but what happens is there's some things that it's just not even practical. Let's say I'm setting it up and I'm watching a basketball game and I'm having it kind of check for a particular move or something like that that has to be on device because that has to be running at 60 frames per second.
And so just sort of the saturation we were talking about a second ago, if we're taking in audio or video or something like that, there's this marriage of the fact that on device one defers the cost that's necessary because your phone with the correct chips isn't going to burn through your memory. It's actually going to handle it just fine. Detecting face is handling this other stuff. It's been that actually the inference on device can happen in microseconds. So giving that part to the device and getting that immediate feedback is really nice. The other thing is that, like I said, it's offline capable. You don't have to worry about, you could add more features without increasing the cost to the application as well because every time you're hitting your server, that's costing you money. When you ship something into the actual device into your app, that's just costing the power on the app.
Now you do have to make sure the trade off, like I said, you don't want to fry people's pockets, but take a look at GPS, right as GPS, we've optimized that to really figure out how to have GPS on in an app and no longer kill your battery. It wasn't that ago that you're like, why is my battery dead? Oh my God, this thing's tracking my location and then now it's dead. So these sort of optimizations really make sense to figure out what's important. There's another last piece here they'll say is privacy. There was that whole idea, remember the Russian aging app that you take a picture and it would tell you what you looked like
Robin Heinze:
And please and somehow they're sending everyone picture like, oh, look at this fun little game. Everyone see what you're going to look like. It was like you just sent all of your faces. You just sent. Yeah,
Gant Laborde:
Exactly. And then so there's this privacy concern that happens with sending things over the network that I think people are way more amicable to having stuff run on device than sending some kind of meta information off over the wire and watching what gets sent there. If you wanted to take a look at me and see whether I'm happy or not, I think what's a cool thing is check my facial sentiment on device and then maybe I'd be okay if you sent happy or sad or I'm enjoying this or not, but if you're sending my face, I start to have a problem with that because that data could be used for a whole bunch of things that I can't get a control of once it's been off my device.
Robin Heinze:
Yeah, yeah. Let's bring this to React native. We're obviously React native developers, and so anything where you're talking about running it on device as part of an application, we're like, can you do this with React native? So what's the answer to that at this point in time?
Gant Laborde:
Well, one of the greatest things that's happened is React native is just this beautiful way of running on multiple platforms. Give it to me. Let me run everything on every platform and make sure it works with ai. It starts to get, I can tell you this, the AI model structure and inference and framework world has gotten this big interesting fight. So maybe I want to use the framework called Pie Torch or maybe I want to use TensorFlow or this or that, and that can become a problem because somebody can show up with a great solution that you're like, I have no idea how to plug this into my app. Fortunately, I will say this is one of the spots where Google is amazing, their capability of running AI on devices that is optimized for the device and runs really quick and runs on multiple devices, including iOS and Android is really good. And so they've done a lot of work in TensorFlow making TensorFlow light models which are optimized for Edge devices. And then lastly, wrapping that whole thing in a framework called ML Kit, which gives you access to custom models, but also really tested extremely useful models that are amazing at running on device.
Robin Heinze:
And so what's the process of bringing that Tree Act native and has that process already started?
Gant Laborde:
Yeah, yeah. Well, as I love is that Mosson knows the answer to this, and I know the answer to this, and Robin an you probably know the answer to this, but I want to make sure. So what's really great is ML kit has a huge library of options that it can do text recognition, digital link recognition, detecting poses, selfie segmentation, which is removing you from your background, all this cool stuff that we want to do already. You don't have to train the model, you don't have to go find the model. You don't have to figure out how to make it run on iOS and Android ML Kit does that, but it does it in native code. So ML kit's a great solution, but fortunately enough, we've been working on our own library, which brings the native code in to work perfectly with React native, and that's React native ML kit under the Infinite Red brand. Now, there is somebody who also has a GitHub repository called React Native ML kit, but we're the one under infinite red. And so we've been slowly taking over these features like scanning faces, object detection labeling and document scanning, and then taking those cool features and bringing 'em in so that you could just within a few lines of code run those ML kit libraries so that they run effectively if they're supported iOS and Android runs for both of them. If it's just supported for one, it runs for one of 'em.
Mazen Chami:
Document scanning is Android only, and this is all open source source for now. For now, of course, and this is all open source, so you could go to that GitHub repo that Gantt mentioned and take a look at it. And I will say I am currently fighting the Apple store reviews daily right now, so we
Gant Laborde:
Could get
Robin Heinze:
Out. I got that email. Yeah,
Gant Laborde:
Sorry. And
Mazen Chami:
Today's
Robin Heinze:
Email was, it's C's not going to be happy about that
Mazen Chami:
One. They attached 10 screenshots of not liking some stuff. And anyways, that goes to classic bringing in the words Google into Apple's ecosystem type of thing. So that's kind of where that friction's coming from. But yes, to answer your question, Robin,
Robin Heinze:
Hopefully by the time this episode comes out, it'll be
Mazen Chami:
That's fingers crossed. Yes.
Gant Laborde:
So the idea of the app here is that we've been, yeah, you can pull down the code and you can kind of see how it works. The problem is you're going to want to run that on a device. You're want to run on a simulator, you're going to want to run it on a device. You want to see what are the capabilities that this can do. We came up with the idea, let's go ahead and release the app store. So every time we get a new feature, let's say there's that feature of automatic reply. So that's one of the cool things that comes in ML kit,
Robin Heinze:
Which Gmail has been doing forever,
Gant Laborde:
Which is Gmail has been doing it. It's awesome.
Robin Heinze:
Google's clearly had this technology for a long
Gant Laborde:
Time, dude, I love that. And then Entity Extractions, the other one where it's like if I sent you a bunch of times, dates and places, I could kind of pull those out of a super cool feature.
Robin Heinze:
Yeah. Also, Gmail's been doing that forever and I love that feature.
Gant Laborde:
Yeah. So let's say you want to add that to a product to one of your apps. Let's say for instance, you wanted smart reply just to go ahead and add it into a chat app that you have there, and one, do you have a PhD in computer science and machine learning? No. Two, do you want to write the framework from scratch? No. Three, do you want to go ahead and train the model from scratch? No. Four, do you want to just go pull something off the shelf and bring it into your React native product so that you can say, Hey, I'll grab that eight point ticket and just bring in the React native ML kit from Infinite Red, they've added this new feature for smart reply support and then bring that in. So let's say that you wanted to see what that looked like before you did that effort.
That's why we want to have an app in the store. You could just download and try some of these things. So right now we've ported over four of the ML kit features to be able to be used and check 'em out. But as we add more features or as people have needs, or if we add some stuff for a client and we want to demonstrate that the app should be there, so the app is effectively just like, Hey, this is possible. Which Google Play Store and Apple Stores, absolutely, they hate that. They hate the demonstration apps, but you can get those through. You just got to put a little story around it.
Robin Heinze:
Hopefully our listeners will be able to go view the source code for these apps on GitHub open source. But just like for the sake of the listeners today, can you go into a bit of a short just user story of what it looks like to use this library and actually see results in your app or what are you actually doing to get from installing the package to having an AI feature in your app?
Gant Laborde:
So I have a fantastic, and this is just going to be a plug for my talk at App JSConf. At App JSConf. I got on stage and I could have just said, Hey, with these few lines of code, you can go ahead and do document scanning. But I feel like that varies what the benefit of this whole kind of process is. So what I did at the talk is I get up there and I go under this whole situation where the client asks for the ability to scan a document, which is a classic thing. I want to scan a check, I want to scan a card, I don't want to do these things. And then I start going into how you would solve this, and I start talking about the math behind it. I start talking about the science behind it. I start talking about all the different features, and I know all this because here at Infinite Red we had a client pay us to figure all those things out and implement exactly that.
And it was a lesson in linear algebra, it was a lesson in all kinds of other features. And then I have this moment where we're like, okay, it's possible. Then I have the client ask for Magic Eraser and running filters and automatically selecting things. And so when you get to that moment, it's just like, geez, we saw how hard it was just to get to step one and they want step five. Yeah. Well, the beauty of it is on stage what we do is we import the library and then just doing one asynchronous call saying to load the entire view for the document scanner and then to bring, and the return for that AY call is to give us the image result. And then on stage I actually do the call scan in front of everybody and then erase my thumb off of the picture magically and then bring it back and then show it in front of everybody in just a few lines of very readable code.
You've taken this first half of my talk where you have this sort of heart attack client ask, and then you go above and beyond in about 15 lines of code and deliver the entire feature. And so I think that that's really cool because all it is is just one call to the React native library to fire off the document scanner. And I think that that really sells it. That really shows what's going on there because you've included a pipeline of ai, which I think is the future. It's not going to be just, oh, I have a chat GPT, I have this one thing here. You're going to have, Hey, I have a virtual concierge hooked to a recommendation engine, also going to my webcam to give me virtual so I can get all these things in one piece. It's going to be a pipeline of ai. And that's kind of like what that experience is with just a few lines of code. That's
Mazen Chami:
Really cool. Another good example is if your app gives the users the ability to upload pictures, I hate that this is the world that we live in, but you need to make sure those pictures are good for consumption based on your user base. So one big thing in ML kit that we have in the app is not safe for work detection. So that's an easy user uploads an app, sorry, uploads a picture. You run it against, again, just a few lines. You're not talking about a lot of lines, few lines. It gives you a green check or a red X, and based on that you can make a decision on do you automatically push that picture to go live or do you have it in a quote processing state where an actual human needs to come take a look at it and kind of do it and you alleviate having whatever this person is, you want to call them, having this person sit and look through every single picture because there's always one in N that's hidden in there that you probably don't want there.
So you can set those parameters as you want. And another large aspect to this is we found some underlying issues in getting ML kit into production apps. It only works in development currently, but that's what we're working on. That's kind of where you can kind of trust us in this process because we're going full circle here. So by the time this app is released, you can comfortably take any of the ML packages from the repository and use them in your project knowing that it's going to work in dev and production, and you can have confidence in it and you can test it out yourself.
Gant Laborde:
Dude, Mazen, that's also a great spot to talk about when you're doing something on server versus on device. The not safe for work image detection feature is something if you were going to have a chat app and you're a startup, you don't have tons of funding, do you have the ability to pay for an entire person to go through and scan all those images and be the moderator of every single aspect of that?
Mazen Chami:
That's usually our CEO, Todd,
Gant Laborde:
Right? And then you get the other thing that happens is you're going to have the server costs of running that on every single image as well. Well, if you have this capability and in just a few lines of code, you could add this in there and it could say, Hey, you've received this image from user 2 38. We've blurred it because we think that it is 97% sure that you should not open this image. Wouldn't that be great if that was a feature and I could click and say, whatever ai, you don't know what you're talking about, I want this image. Or I could be like, I don't know who this person is, deny the image and kind of block this person while we're at it as well. You could build that entire thing and it costs you zero server costs and it runs in just a few lines of code, and it's a feature added immediately. This is idea one of an infinite number of ways that you could apply AI to make products and user experiences even better.
Robin Heinze:
Awesome. Well, unfortunately, I think we're getting to the end of our time. Oh, I know GAT could probably talk about AI all
Gant Laborde:
Day long. Yeah, I'm just getting warmed up. This was fun.
Robin Heinze:
But we'll make sure to put all those links in the show notes to all of the great things that we talked about. I'll leave you all with a mom joke. What kind of fe lines can bowl alley cats? Chuckle, chuckle, chuckle, chuckle.
Gant Laborde:
I like the pause you used
Robin Heinze:
Before you told me I was waiting for you to laugh and it didn't happen.
Gant Laborde:
Well, I'm not going to laugh until you do that, but the pause there. Yeah,
Robin Heinze:
Pause because it's an alley cat rear. Okay. That's right. Alright, someone should stop me. We will. I'll stop you, right? Meow. Alright, we'll see you all next time.
Jed Bartausky:
As always, thanks to our editor, Todd Werth, our assistant editor, Jed Bartausky, our marketing and episode release coordinator, Justin Huskey and our guest coordinator, Mazen Chami. Our producers and hosts are Jamon Holmgren, Robin Hines and Mazen Chami. Thanks to our sponsor, infinite Red. Check us out at infinite.red/radio. A special thanks to all of you listening today. Make sure to subscribe to React Native Radio on all the major podcasting platforms.
There’s no perfect time to get started. Whether you have a formal proposal or a few napkin sketches, we’re always happy to chat about your project at any stage of the process.
Schedule a call