5 Unique Python AI Project Ideas & HOW To Build Them

57.93k views3578 WordsCopy TextShare
Tech With Tim
In this video, I will be sharing with you 5 Python AI projects and exactly how to build them. Not on...
Video Transcript:
today I'm sharing with you five python AI projects and exactly how to build them that means that not only will I give you the idea but I'll walk you through the different modules you should use and even give you a quick code sample so you can get a good idea of how to get started with these projects now make sure you stick around until the end because these projects go from easy to difficult and the last project is definitely something that you'll want to try out especially if you're really getting into the AI space with
that said let's get into it here with the first project now the first project on my list is definitely a simple one but this is a sentiment analysis tool now this involves reading in some kind of textual data and analyzing the sentiment or how positive or negative it is so think about reading things like movie reviews or YouTube comments or actually texts on your phone from your friends or your mom or whoever it may be and determining whether those are positive negative or neutral this has all kinds of real world application obviously you could build
this out and create something that uses sentiment analysis as part of a larger application and I think it's a really good starting project for people that are just getting their feet wet with AI in Python now in order to build out a project like this in Python you have a lot of different options and modules that you can use but I'd recommend sticking with the following the first is natural language toolit or nltk this contains some pre-built data sets for you that can make your life a lot easier next pandas this is great for data
pre-processing and preparation and a module you really should get good at if you want to do Ai and python and then lastly scikit learn which is what you'll actually use for creating a model that can do kind of the AI and predict if the sentiment is positive or negative of specific text now let's hop over the computer and I'll walk you through a really quick code snippet and you can see what the structure of the project should look like so let's review a short sample of a finished version of this project you can see I'm
using natural language toolkit pandas and SK learn first thing I do here is download a data set that is my movie reviews I then pre-process that data set by grabbing the correct fields that I want and storing this in a pen is data print I then convert my textual data into vectors so I can use this properly in my model and then I split my data into training and testing data I take 20% of the data for testing and evaluating my model and the remaining 80% for doing the training I then create a model train
the model using the fit function and then evaluate the model and see how well it performed on my testing data after that I write a simple function that allows me to get a prediction from my model and then I have a few strings here that I'm going to use to test the performance so if I bring this up and I run my code Python 3 Pro 1. Pi you can see it prints out all of the stats from my model and the accuracy which was 80% and then it tells me that it predicted the first
string was a positive sentiment and the other two were negative there you go that is a quick code sample of project number one which will be available to download from the link in the description now I think it goes without saying that if you want to build out that project or other ones that I'll mention in in this video well you need to know Python and be pretty decent at it now that's where a good friend of the channel HubSpot comes in with this entirely free resource giving you a great introduction to the Python language
whether you're a marketer developer or data analyst this guide is perfect for you it covers what python is key methods and functions coding standards and best practices Advanced python techniques and so much more I've included a link in the description where you can check it out completely for free python is an incredibly popular language and a great skill to learn even if you don't plan on becoming a professional developer and this guide will show you exactly the potential you can unlock by just getting even decent at the Python language now personally my favorite part of
this guide is the great overview of objectoriented programming terms which helps act as a great reference cheat sheet now HubSpot provides this resource and tons of others completely for free and a massive thank you to them for sponsoring this video and making this content possible you can check out this for free from the link in the description now once you finished your sentiment analysis project the next one I recommend you work on is an image classifier this involves reading in some kind of image data learning about things like convolutional neural networks and being able to
classify different images based on the pixels or the data that's contained inside of them there's a lot to learn here you can make some pretty cool stuff if you want just the basics or what most people do when they're starting out they'll classify things like digits so there's actually a very famous project in uh tensor flow where you're able to classify different digits 0 through 9 if you want to be a bit more complicated or unique than that you could classify things like animals you can classify different household items you can classify really anything that
you want as long as you have enough data now in order to build out this project in python as always you have a lot of different options but what I'd recommend is that you stick with tensor flow and caras now caras is like a high level API on top of tensorflow it makes it easy to actually work with tensorflow and do some standard operations so you don't need to be a complete expert and understand everything about neural networks in order to build out this project after that I'd recommend using something again like pandas and numpy
these are kind of the go-to modules that you're probably always going to be using in combination with something a bit more advanced again like tensorflow and caras in this situation now let me go over to the code sample and you can see exactly how you would build out a project like this let's have a look at a quick code sample of this finished project you can see here I'm using tensorflow caras and the map plot lid to do some plotting of the image so I can see what it looks like when I do my prediction
I'm using a data set here that I'm loading from caras this has 10 different images and their classifications it's a mix of animals and objects I obviously split this into training and testing images I check if I already have a model that exists that I've already trained if I do I load that in otherwise I train one from scratch using a convolutional neural network I then create the model train it and then save it to disk and then I use it down here to actually do a classification of some various images so I just pick
a random image from my test set when I run my code here you'll see that it opens up a map plot lib window it says that it predicted this was a ship and the true classification was indeed a ship obviously this is not always perfect and you can see the image is quite blurry but it does indeed represent a ship if you wanted to have higher resolution images you could do that but in order for the model to run quickly I just kept it pretty low res for this example now the next project on my
list here is a voice assistant with speech recognition now this simply means that rather than doing everything with text you actually speak to your computer using the microphone and then get a response back from the computer using the speaker so this is pretty interesting and you can make this go quite far and combine it with other AI tools for example you could do something like sentiment analysis using speech recognition so is the sentence you just said positive or negative that's a basic example and I'll show you a few others in this section now in order
to build out a project like this you need something that can do speech to text and text to speech now in Python you have a few options but I'd recommend you use the speech recognition module to go from speech to text it's quite good and works in multiple languages and then for going from text to speech I recommend you use Pi ttsx 3 this is a pretty popular module that again can take some textual data and then actually respond or kind of give you some audio voice on the computer now as well as that you
probably want to combine this with some other AI features so what I'd recommend is using some kind of llm so something like open AI or using a local llm on your computer with something like o llama so you could use something like llama 3 locally on your own machine and this can actually be what responds to your query so I can say something to the computer take that so speech to text it get the text pass that to a local llm take that data and then go speech to text or go text to speech sorry
so the llm generates the reply and then we use the text to speech module to actually answer back now that's basic that's just responding to something that you're saying but if you want to go a step further you could give this some different capabilities like the ability to save a note for you or to access your calendar and tell you the different events that are coming up and I'm going to get into a quick code snippet here so you can see exactly an example of a project you could build that uses these types of features
looking at a quick code sample here what I'm actually showing you straight out of a whole tutorial series I have on this channel where I build a voice assistant that's able to manage my calendar if I were to do this again I would make it a little bit better and Implement llms here all we're using is pi ttsx 3 and speech recognition what this does is actually access my Google Calendar uh there's some complexity in terms of how that works but you can see we have a function allows us to speak allows us to get
our audio we authenticate against Google so we can view the calendar and then we have some functions that allow us to get various events so get the different calendar events that are happening on particular days and then give us summaries of those events again not going to run through all of this code but the idea is I can ask it what do I have planned do I have plans am I busy these are just some set strings that I've kind of ridden myself if any of those strings exist we're going to grab the date from
those strings get all of the events and then actually speak those out loud and kind of give us a summary of what it is that we have going on I've also added some functionality here that allows this to save a note so if I say make a note write this down remember this then it actually just creates a new note for us on our computer obviously if we implemented llms here we can make this a lot better and that's what I would do if I was building this completely from scratch again the next project idea
I have for you is a recommendation system now this is a bit more difficult to build out just because of the type of data that you need but it's super cool and something that will really teach you how a lot of the recommendation systems actually work so you go to Netflix you watch a movie you like a movie you add it to watch later whatever and all all of a sudden sory you're getting a ton of other recommendations for movies how does that actually work well that's what this project will teach you now in order
to build this out what you really need is a lot of data that has user preferences so what I mean by that is you have maybe some kind of user ID and if we take the example of Amazon we'd have all of the different products that a user has bought or that a user maybe has reviewed although a lot of people don't review stuff so probably just what they purchased or maybe what they've purchased multiple times now what we can do is we can go and find similar users that have a similar purchase pattern and
find something that they've bought that the other user has not bought and give them that recommendation so let's say I bought a bunch of random items user B bought all those same things they very similar things plus some other item Well we'd find that item and then recommend that to me that's a really basic explanation of how this works but you need some kind of user preferences like maybe post that people have liked piece of content that someone's purchased or that they've watched or if you have their actual rankings or reviews of different for example
movies or books then that's a great way to build out these types of systems now in order to build out a project like this you have a lot of different options but I'd recommend using a module in Python called surprise now this module is specific for building recommendation systems it contains a lot of pre-built functionality it will make your life significantly easier other than that you can use things like pyit learn tensorflow P torch for the actual models themselves and then of course you're probably going to be working with things like pandas and numpy anyways
let me show you a quick example of a recommendation system that I built in Python so let's have a look at a quick code sample here you can see that we're using the surprise module and we're downloading some files here that contain the movie lens data set now the only data that we actually need here for doing our training is some user ID some Item ID and then the rating that this user had associated with that so when we have that that's enough to actually do all of these predictions but we bring in some extra
data so that we can tell the user exactly what the movie information is that we're recommending to them later on by associating the item ID with all of the other um kind of categories that we have for our actual movies anyways what we do now is we create this reader object here in Surprise and we load in our data frame with the columns that we want you can see that we don't need the timestamp column here so that we have a format surprise can understand we then split our data again into training and testing data
and we use a singular value decomposition algorithm uh to actually perform this recommendation system we then train the model with our training data and then we get some predictions and accuracy using our testing Sy set we then create a recommend function here what this actually does is it passes to the model a user ID and an item for every single item that we have so all of the different movies that we have now what this will do is give us a predicted rating for that particular movie for that user based on again um all of
the similarities it has with other users then what we can do is we can get all of the movies that were predicted to be rated the highest by this user and that's what we can recommend them which is exactly what we're doing in this function so you can see we pick a random user ID here we say okay we want five movies to be recommended and then if I go up here and run my code so Python 3 project 4py you'll see that we get some movie recommendations so you can see here that we have
five movies recommended here it gives us the title some information and then what the predicted rating would be for that particular movie for that user Now we move on to my final project idea which is definitely my favorite and that is to build an a AI agent now an AI agent typically utilizes some kind of llm maybe has some ride capabilities retrieval augmented generation and then typically interacts with its environment and actually calls things like API saves information to a database does something like save a node or schedule an event in your calendar and it's
very cool because it kind of Acts on its own and picks what type of task it should perform based on what you asked it now in order to build out something like an AI agent again you have a lot of different options here but I'd recommend using something like laying chain or llama index these are the big players kind of in the llm space right now that allow you to interact with different llms and then build out these agent capabilities I have a ton of videos on my channel where I build out these different types
of agents and what I'll do is quickly go over to the computer and run you through a code sample where I do exactly that build an AI agent so you can see a little bit about how it works another thing to mention here is that of course you can use paid models like GPT right you can go use chat GPT and pay for a a token or pay per usage or you can use something known as olama now olama allows you to actually run llms locally on your own computer you do need a pretty powerful
machine if you want to use the higher-end models that have a lot of parameters and I made some videos on the Channel showing you how to use AMA but this is a great alternative if you don't want to pay for something like chat GPT anyways let's have a quick look at that code sample so let's have a look at a quick code sample of an AI agent I built in a full tutorial on this channel now this AI agent has access to two tools the first tool can fetch GitHub issues and kind of give us
responses based on various issues in a repository the second can save a note to our computer now what this uses is a vector store database to store all of the GitHub issues the reason it does that is so we can very quickly access the issues that we need and then use them in a response from our llm this is called rag or retrieval augmented generation not going to run through all of the code here but you can see that what I do is I create a tool here called the retriever tool and I give AI
the description of what this tool does it says search for information about GitHub issues for any questions about get up issues you must use this tool I also give it access to another tool called the note tool and you can see this saves a note to a local file now what happens is when I start using this agent and I ask it some kind of question based on the question that I asked it will be able to reach out and use one or all of these different tools so if I ask it about GitHub issues
then it will start kind of using that tool and give me GitHub issue related responses if I ask it to save a note then it will use this note tool now I can't run this right now because the environment variables are not configured that's the basics on how you make an AI agent this is super cool and if you want to learn more about this then check out the video I'll leave on screen [Music]
Copyright © 2025. Made with ♥ in London by YTScribe.com