How To Develop AI Apps 100% For FREE!

Jack Herrington
22 Jul 202412:22

Summary

TLDRThis video script is a guide for front-end developers to enhance their skills by integrating AI into their UI development. It emphasizes the importance of AI in the job market and offers a free, local-first approach using open-source AI models with 'oama' and 'versals AI SDK'. The tutorial walks through building a chatbot and a photo review app with minimal code, showcasing the ease of implementing AI and encouraging developers to boost their employability by learning these skills.

Takeaways

  • πŸš€ Encouragement for front-end developers to build UI for AI skills as AI is a hot trend and beneficial in the job market.
  • πŸ’‘ Introduction of using open AI for free to play around without worrying about costs, suggesting local first development.
  • πŸ› οΈ Utilization of 'oama' to download and run free open source AI models on a local machine.
  • πŸ”Œ Mention of 'versals AI SDK' as an interface to work with the AI models.
  • πŸ“ Building a chat bot in just 20 lines of code using the AI SDK and oama.
  • 🎨 Excitement about creating a photo viewer app with AI to review and suggest improvements on images.
  • πŸ”„ Demonstration of using 'oama' commands like 'oama list' and 'oama rm' to manage AI models.
  • πŸ“š Selection of AI models like '53' from Microsoft for chat functionality and the ability to run multiple models.
  • πŸ›‘ Explanation of creating a Next.js application with specific features like TypeScript, ESLint, Tailwind CSS, and app router.
  • πŸ”— Integration of the 'AI toolkit' from versal, 'oama mpm module', and 'oama AI provider' for connecting to AI models.
  • πŸ“ Instructions on building the homepage of the app using the 'useChat' hook from the AI SDK for interactive chat functionality.
  • πŸ–ΌοΈ Creation of a second app using 'lava llama 3' for image AI, allowing users to upload photos for AI review.

Q & A

  • What is the primary recommendation for front-end developers in the current job market?

    -The primary recommendation is to build up their UI for AI skills, as AI is super hot right now and having experience with developing for it is critical in the tough job market.

  • What is a cost-effective way to start developing with AI without incurring high costs?

    -A cost-effective way is to use local first development with open AI models. This can be achieved by using Olama to download and run free open source AI models on your machine.

  • What is Olama and how is it used in the development process?

    -Olama is a tool used to download and run open source AI models on your machine. It allows developers to interface with AI models locally without incurring costs from cloud services.

  • How can you interface with the AI models using Olama?

    -You can interface with the AI models using the Versal AI SDK, which provides an open source AI interface layer that works with Olama.

  • What is the significance of building a chat bot with just 20 lines of code?

    -Building a chat bot with just 20 lines of code demonstrates the simplicity and efficiency of using AI tools like Olama and Versal AI SDK, making it accessible for developers to quickly prototype and test AI applications.

  • What are the steps to get started with Olama and AI models?

    -First, download and install Olama using a package manager like Brew on a Mac. Then, start the Olama service and download a model, such as the chat model from Microsoft. Finally, use commands like 'o llama list' and 'o llama RM' to manage the models.

  • How can you create a simple AI chat application using Next.js and Olama?

    -You can create a simple AI chat application by using 'create-next-app' to set up a new Next.js project, adding necessary libraries like the AI toolkit from Versal, the Olama CLI module, and the Olama AI provider. Then, build out the homepage using the 'useChat' hook from the AI SDK.

  • What is the role of the 'useChat' hook in the AI chat application?

    -The 'useChat' hook from the AI SDK provides the necessary data and functions for managing the chat interaction, such as messages, current input value, handleInputChange, and handleSubmit.

  • How can you handle the server-side logic for an AI chat application in Next.js?

    -You can handle the server-side logic by creating an API route in Next.js, such as 'api/chat', and using the Olama AI provider to connect to the AI model and process the messages.

  • What additional features can be added to enhance the AI chat application?

    -Additional features can include formatting the AI responses using React Markdown to handle markdown formatting, and building more complex applications like an image review app using AI models for image analysis.

  • What is the purpose of the second application mentioned in the script, and how does it utilize AI?

    -The second application is an image review app that allows users to drop a photo onto the app. It utilizes AI to review the photo and provide feedback on what's good, what's bad, and how it can be improved.

  • How can you integrate AI for image analysis in a Next.js application?

    -You can integrate AI for image analysis by using Olama to run an image AI model like Lava Llama 3, and then creating an API route in Next.js to handle the image file, send it to the AI, and process the response.

Outlines

00:00

πŸ€– Building AI Skills for Front-End Developers

This paragraph emphasizes the importance of AI skills for front-end developers in the current job market. The speaker encourages developers to explore AI by using open-source tools without incurring significant costs. They introduce the use of 'oama' for running AI models locally and 'versals AI SDK' for interfacing with these models. The paragraph showcases a simple implementation of a chatbot using just 20 lines of code, demonstrating the ease of getting started with AI development.

05:01

πŸ› οΈ Developing a Chat Application with Local AI Models

The speaker provides a step-by-step guide on setting up a local AI development environment using 'oama' and installing a chat model from Microsoft. They explain how to interact with the model using terminal commands and proceed to build a chat application using 'create next app' and various libraries including the 'AI toolkit' from 'versal'. The process involves creating a homepage, integrating the 'useChat' hook from the AI SDK, and setting up a form for sending messages to the AI. The paragraph concludes with a live demonstration of the chat application in action.

10:02

πŸ“Έ Creating an AI-Powered Photo Reviewer App

This paragraph delves into building a more complex application that uses AI for image analysis. The speaker introduces 'lava llama', an image AI model, and demonstrates how to use it to describe an image locally. They guide through creating a new application called 'cheap AI photo reviewer' using 'next' with similar configurations as the previous app. The focus is on setting up APIs to handle image files, using 'react Drop Zone' for drag-and-drop functionality, and integrating 'react markdown' for message formatting. The paragraph ends with a live test of the app, showing the AI's ability to review and provide feedback on a photo.

Mindmap

Keywords

πŸ’‘React Dev

React Dev refers to a developer who specializes in building user interfaces using the React JavaScript library. In the video's context, the speaker encourages React developers, as well as other front-end developers, to enhance their skills with AI capabilities, which are highly sought after in the current job market. The script mentions building a UI for AI, indicating the importance of integrating AI functionalities into modern web applications.

πŸ’‘Front-end Dev

Front-end development is the process of creating the user interface and user experience of a website or application. The term 'front-end Dev' is used in the script to address the target audience of the video, which includes developers who work on the client-side of web applications. The video emphasizes the importance of these developers learning AI skills to stay competitive in the job market.

πŸ’‘AI Skills

AI Skills refer to the abilities and knowledge required to work with artificial intelligence technologies. The script discusses the importance of building up UI for AI skills, as AI is a rapidly growing field with high demand. The video provides a practical approach to learning AI by using open-source tools and developing applications that integrate AI functionalities.

πŸ’‘Open AI

Open AI is a term that can refer to AI technologies that are publicly available and not restricted by proprietary licenses. In the script, the speaker mentions using Open AI to play around with AI models without worrying about high costs, suggesting that there are affordable or free resources available for developers to learn and experiment with AI.

πŸ’‘Local First Development

Local First Development is an approach to software development where the primary focus is on creating applications that work well on the user's local machine, even when offline. The script introduces the concept of using 'local First Development' with AI, emphasizing the use of open-source AI models that can be run on a developer's machine without reliance on the internet or cloud services.

πŸ’‘Olama

Olama is mentioned in the script as a tool for downloading and running free open-source AI models on a local machine. It is part of the process of setting up a local environment for AI development. The script describes using Olama to install and run a chat model, demonstrating how to interact with the AI model locally.

πŸ’‘Versal AI SDK

Versal AI SDK is an interface layer for AI development, which is mentioned in the script as a tool to be used alongside Olama. It is used to interface with the AI models that are running locally on the developer's machine. The SDK is part of the process of building applications that can communicate with and utilize AI models.

πŸ’‘Chat Bot

A chat bot is an AI-powered program designed to simulate conversation with human users. In the script, the speaker builds a chat bot using just 20 lines of code, demonstrating the ease of integrating AI into applications. The chat bot is an example of how AI can be used to create interactive user experiences.

πŸ’‘Photo Reviewer App

The term 'Photo Reviewer App' is used in the script to describe a more complex application that uses AI to analyze and provide feedback on photos. The app allows users to drop a photo, and the AI reviews the photo, offering insights on its quality and suggesting improvements. This showcases a practical application of AI in a non-chat context.

πŸ’‘Lava Llama

Lava Llama is an image AI model mentioned in the script, which is used for the photo reviewer app. It combines image analysis capabilities with language model functionalities to provide descriptive feedback on images. The script demonstrates using Lava Llama to describe an image of a dog, highlighting its ability to analyze visual content locally and provide responses.

Highlights

Encouraging front-end developers to build up their UI for AI skills as AI is super hot in the current job market.

Using open AI for free by downloading and running open source AI models locally.

Utilizing the olama tool to download and run AI models on a local machine.

Installing AI models like model 53, a chat model from Microsoft, using olama.

Building a chat bot in just 20 lines of code using the versals AI SDK.

Creating a Next.js application called 'cheap AI chat'.

Using the AI toolkit from versal and olama mpm module to interface with AI models.

Building a homepage with a client component using the useChat hook from the AI SDK.

Creating a form to send messages to the server using handle submit from useChat.

Displaying messages from the chat bot in a flex box layout.

Setting up an API endpoint in Next.js to connect to the AI model.

Using the createOlama function from olama AI provider to interface with AI.

Streaming text response from AI using the streamText function.

Integrating React Markdown to format AI responses in markdown.

Building a second application, a photo reviewer, using local AI to review images.

Using lava llama 3, an image AI model, to describe images.

Creating a Next.js application called 'cheap AI photo reviewer'.

Using react Drop Zone to create a drop target for image files.

Sending base64 encoded image files to the AI for review.

Using the EdDropZone hook to handle file uploads and convert them to base64.

Submitting encoded files to the API server using useEffect.

Encouraging developers to learn AI to enhance job skills and employability.

Announcing a new course on ProNextJS focusing on building advanced chat applications.

Transcripts

play00:00

if you're a react Dev or really any kind

play00:02

of front-end Dev I strongly encourage

play00:04

you to build up your UI for AI skills AI

play00:07

is just super hot right now and having

play00:09

experience with developing for it is

play00:11

critical in this tough job market but

play00:14

how can you get started for free using

play00:16

open AI doesn't cost a lot of money if

play00:18

you're doing just a little bit but still

play00:20

you want to be able to just play around

play00:21

with it and not worry about a Big Bill

play00:24

at the end while the answer is local

play00:26

First Development we use oama to

play00:30

download and run our free open source AI

play00:32

models on our machine and then we'll use

play00:34

versals AI SDK to interface with it and

play00:37

then we'll build a chat bot in like 20

play00:39

lines of code I'm serious I'm not

play00:41

kidding and then we'll build this cool

play00:43

photo R viwer app in just a few more I'm

play00:46

so excited let's get into

play00:50

[Music]

play00:54

it all right so as I say the important

play00:56

parts here are this AI toolkit from

play00:59

versal it's just an open source AI

play01:01

interface layer it's very good though

play01:05

we're going to use open Llama locally to

play01:07

actually run the models on our machine

play01:09

now you can get started by just hitting

play01:10

that download button I'm going to use

play01:12

Brew install for that since I'm on a Mac

play01:15

so I'm just going to do Brew install and

play01:17

then o

play01:21

Lama okay the next thing we're going to

play01:23

do is start the olama service

play01:27

cool now that we got AMA set up what's

play01:29

let's go and install a model so I'm

play01:31

going to pick off the top of my head

play01:33

just 53 this is a chat model from

play01:36

Microsoft there's Gemma 2 there's a

play01:38

bunch of different chat models that you

play01:39

can get just go over here to models and

play01:41

you'll actually see all of the models

play01:43

that you can download and run and you

play01:45

can run as many of them as you want to

play01:47

or as your machine can handle so let's

play01:49

try out 53 though I'm going to copy that

play01:52

going to go in my terminal and do o Lama

play01:55

run 53

play02:02

okay the model's all downloaded let's

play02:04

ask it to say

play02:06

hello

play02:08

taada pretty cool all right so now that

play02:11

we've got our olama model running let's

play02:14

show you let me show you a few more

play02:15

commands I can do ol llama list that'll

play02:18

show me any models that I've installed I

play02:20

can also do o llama RM if I just want to

play02:23

get rid of it I don't want to because we

play02:25

just installed it so now let's go and

play02:28

build our first app so I'm going to use

play02:30

create next tab at latest to create our

play02:32

first application cheap AI chat so of

play02:35

course all the code for this available

play02:36

to you on GitHub 4 free in a link in the

play02:38

description right down

play02:40

below I'll use typescript yes lint and I

play02:43

do want to use tail one CSS in this

play02:45

case I'm going to use the app router and

play02:48

there we

play02:50

go looks like we're all set up let's

play02:52

bring it up vs

play02:53

code all right now we've got to add some

play02:55

libraries the first one we're going to

play02:56

add is AI That's the AI toolkit from

play02:59

versell

play03:01

next up we're going to bring the oama

play03:02

mpm module into our app that's what we

play03:04

use on the command line to run any oama

play03:08

commands and connect any models and any

play03:10

of that so that's going to actually

play03:12

interface with

play03:14

oama and then to connect those together

play03:17

I'm going to use the olama AI provider

play03:19

it's a nice mpm module that connects the

play03:21

versal AI SDK to

play03:24

O all right now the next thing I'm going

play03:26

to do is build out the homepage so let's

play03:28

go over to page and I'm going just going

play03:29

to replace this with an empty page now

play03:32

that empty page is going to be a client

play03:34

component because this is all going to

play03:35

be interactive now the first thing we

play03:36

need to bring in is the use chat Hook

play03:39

from the AI

play03:40

SDK now that AI SDK has a react section

play03:44

so it works with all kinds of Frameworks

play03:46

also react so in the react module you

play03:48

get the use chat hook now we're going to

play03:51

call that use chat hook with no options

play03:53

and we're going to get back a bunch of

play03:54

things we're going to get messages

play03:55

that's the messages that we've had with

play03:57

the chat bot and then the current input

play03:59

value that's going to be for the text

play04:01

field where we input stuff handle input

play04:03

change which is what we're going to use

play04:04

on the unchange of that input field and

play04:06

then handle submit which is what we're

play04:08

going to call when we actually want to

play04:10

hit the return and then send the message

play04:12

to the AI next we'll build out the

play04:15

starter jsx we'll have a flex box we in

play04:18

in a column full width a little bit of

play04:20

padding on the sides and then we'll

play04:22

stretch it out so that it uses up the

play04:24

entirety of the vertical space next we

play04:26

need a way to send a message to the

play04:28

server so we'll create a form tag it'll

play04:30

have an onsubmit using that handle

play04:32

submit that we got back from used chat

play04:35

and then an input field which is

play04:36

connected to that input we give the

play04:37

value as the input and the onchanges

play04:39

handle input change pretty easy now

play04:42

finally the last thing we want to do is

play04:43

just display the messages so we'll add

play04:46

some code to iterate through all those

play04:47

messages with map and then just display

play04:48

them in a nice little output okay so far

play04:52

so good let's bring that

play04:55

up so I'm going to bring up my simple

play04:58

browser go to Local Host

play05:01

3000 and that's looking pretty good let

play05:03

me anchor that over on the side there

play05:05

okay nice now if I were to do something

play05:08

like say hello it's not going to do

play05:11

anything and that's because we don't

play05:12

actually have an endpoint for to connect

play05:14

to to send the messages to Now by

play05:16

default since I haven't changed any

play05:17

options on use chat the API that it

play05:19

wants to connect to is SL API chat so

play05:23

we're going to go and create that so go

play05:25

back over here in our app create API

play05:28

chat and then route. s that's a route

play05:30

Handler in nextjs then I'm going to

play05:33

handle the post method in here that's

play05:35

going to receive the request when we get

play05:38

the handle submit from the client all

play05:40

the messages are going to come in as

play05:42

messages in Json and now we actually

play05:44

want to start building out our

play05:45

connection to the AI so the first thing

play05:47

we need is the create olama function

play05:49

from olama AI provider and we'll just

play05:52

invoke that now create our o llama

play05:54

interface and next we want to bring in

play05:56

streaming text response stream text and

play05:58

stream data from AI That's going to

play05:59

handle the streaming response back from

play06:02

the AI we don't just want it to come out

play06:03

as one go right we want it to actually

play06:05

go token by token otherwise you'll be

play06:07

there waiting for a while for the

play06:08

response so we're going to use this

play06:10

streaming function that they got built

play06:11

into it all right now we get to call our

play06:14

Ai and that's it all you got to do is

play06:16

just stream text you give it the model

play06:18

in this case AMA with that 53 model that

play06:20

we added and then the messages and then

play06:23

we return a streaming text response with

play06:25

the AI stream that we get back out of

play06:27

that result all right let's give it a go

play06:34

whoa seriously it was that easy how cool

play06:38

is that okay I'm going to ask something

play06:40

a bit more

play06:41

complicated what are the steps in

play06:42

bathing a stinky

play06:45

dog all right now as you can see what's

play06:48

coming out here is markdown that's the

play06:51

for example these double stars that

play06:53

should be bold so just to add a little

play06:56

bit more complexity here let's go and

play06:58

bring in react markdown to format

play07:01

that now we'll launch the server again

play07:04

we'll go back into our page we'll bring

play07:07

in the markdown component and then we'll

play07:09

just wrap everything in the content in

play07:13

markdown right let's try it one more

play07:15

time how to bathe a stinky

play07:19

dog and there we go now you can start to

play07:21

see we got the Bolding in there this

play07:24

looks really nice and that's it as you

play07:26

can see this is just super easy to do of

play07:28

course all the codes available to you

play07:29

for for free on GitHub and you can run

play07:31

this thing anywhere now that you got o

play07:33

Lama installed on your machine you could

play07:35

run it on a plane you could run it at

play07:38

the park while you're watching your kids

play07:40

play in the park you can do anything

play07:41

with this it's fantastic Jump On In have

play07:43

some fun learn AI I'm telling you it'll

play07:46

help you in the job market so the second

play07:48

application is a bit more complex just

play07:50

kind of shows how to use AI in a non-

play07:52

chat more applied style we're going to

play07:55

allow the user to drop a photo onto the

play07:58

app and then we're going to use a local

play08:00

AI to kind of review the photo and tell

play08:01

us what's good about it what's bad about

play08:03

it how it can be improved okay so let's

play08:05

now go and build our second app so the

play08:08

second model they're going to bring in

play08:09

is lava llama lava is an image Ai and

play08:13

llama 3 is an llm and they've kind of

play08:15

Squish those two together and now you've

play08:17

got a really good image AI that can do

play08:20

llm type chat work okay cool so let's

play08:23

bring that

play08:25

in we're going to use o Lama run lava

play08:28

llama 3

play08:30

and now that we've got that installed

play08:32

I'm going to use it to describe this

play08:34

image of my dog murf so now I'm going to

play08:37

say describe this

play08:40

image give it a path downloads dog.

play08:48

jpeg how cool is that and it's local we

play08:52

have to pay anything for that that is so

play08:54

awesome it's amazing what you can do in

play08:56

open source nowadays okay so now let's

play08:59

go build an app around this so again I'm

play09:01

going to use next I'm going to call it

play09:02

cheap AI photo reviewer I'll use all the

play09:05

same options as last time including

play09:08

Tailwind I'm going to jump in there with

play09:10

vs code and I'm going to speedrun this a

play09:13

little bit of course all the code is

play09:14

avable to you for free so after we're

play09:16

done you can take a look at it download

play09:17

it try it out for yourself so we're

play09:18

going to bring in that AI Library olama

play09:20

AMA AI provider as we did before react

play09:22

markdown I'm also going to bring in

play09:24

react Drop Zone since we want to create

play09:25

a drop Target so you can just drop your

play09:27

image onto the app

play09:31

this time I'm going to start with the

play09:32

API first so we create a new directory

play09:33

called API chat again and then route. TS

play09:36

and I'm going to do all the stuff we did

play09:37

before creating the llama and getting

play09:38

all the stuff set up for AI but the

play09:41

prompt is going to look entirely

play09:43

different so what we're going to get

play09:44

from the Json in this case are Bas 64

play09:47

encoded files and then we're going to

play09:48

send those off to the AI the way that

play09:50

we're going to do that is call that

play09:51

stream text function from AI we're going

play09:53

to give it the O llama adapter with lava

play09:56

Lama 3 and then we're going to give it

play09:58

some messages now this is the prompt

play09:59

engineering that everyone talks about

play10:01

you give it some messages and in this

play10:02

case you're going to set up the system

play10:04

you're going to tell it what it needs to

play10:05

behave like and then in this case we're

play10:07

going to say that the second message

play10:09

comes from the user user asking please

play10:11

review this photo and then we're going

play10:13

to send it the encoded image file okay

play10:16

so we got our API all set up let's now

play10:19

go and build out our page we're going to

play10:21

use that use chat Hook from AI but we're

play10:24

also going to have these encoded files

play10:26

they're going to be the files that we

play10:28

get from Drop Zone next we bring in the

play10:30

Ed Drop Zone hook that's what's actually

play10:32

going to do the work of accepting those

play10:34

files turning those into base

play10:36

64 and then adding those files to the

play10:38

list of encoded files and then we

play10:40

finally we add a use effect that says

play10:42

cool if we got some new encoded files

play10:44

then fire off that handle submit and

play10:47

just submit those to the API server all

play10:49

right let's give it a go and

play10:52

see unfortunately that simple browser

play10:54

doesn't handle drag and drop so I'm

play10:56

going to use ARC for this I'm going to

play10:58

drag my photo of murf on there and now

play11:01

we see it's having a good look at our

play11:02

photo and boom we've got the output from

play11:06

the AI

play11:08

mindblowing of course all the code for

play11:10

this example and the other one is

play11:12

available to you on GitHub for free I

play11:13

encourage you to play around with it AI

play11:16

is something you're really going to want

play11:17

to get into to enhance your job skills

play11:20

and employability at this point well I

play11:22

hope this got you excited about learning

play11:23

how to build uis for AI how to do it on

play11:26

your own machine local first if you do

play11:28

that let me know in the comments right

play11:30

down below I would love to hear about it

play11:33

and if you're into advanced content like

play11:35

this go over to pron nextjs doev that's

play11:37

where my new course on pron nextjs is

play11:40

just about to be deployed sign up for

play11:42

the newsletter today you'll get access

play11:44

to two free tutorials one on State

play11:46

Management one on fors management and I

play11:48

got to tell you the first part of this

play11:50

new course is going to be on building a

play11:52

chat application just like this but a

play11:54

lot more advanced and using all of the

play11:57

cool features of the nextjs app router

play11:59

I'm really stoked about it of course in

play12:02

the meantime if you like this video

play12:03

please hit that like button it really

play12:05

helps out with the algorithm hit the

play12:06

Subscribe button if you want to see more

play12:08

content like this and click on that Bell

play12:10

if you want to be notified about it I'll

play12:12

see you on the next Blue Collar coder

Rate This
β˜…
β˜…
β˜…
β˜…
β˜…

5.0 / 5 (0 votes)

Related Tags
AI DevelopmentFront-EndOpen SourceLocal AIChat BotPhoto ViewerReactVersal AIOlamaJob Market