GPT3 Powered Text Analytics App

AI Anytime · Beginner ·🧠 Large Language Models ·3y ago

Key Takeaways

The video demonstrates how to build a text analytics application using GPT3, Streamlit, and Python libraries like SpaCy and WordCloud, showcasing advanced technologies for extracting key insights from text.

Full Transcript

hello everyone welcome to AI anytime channel in today's video we are going to build an streamlit application uh gpt3 Power text analytics application where we will use gpt3 model open AI gpt3 models like DaVinci 3 and then we'll also use this Spacey for name entity recognition so we'll perform any r on text and then we'll also find out some key insights okay like we will have some visual representation with the help of word cloud we'll also find some most positive words in the text and we'll also find out a summary of the text okay and we are going to utilize open AI gpt3 model and we're also going to use Spacey and couple of other libraries to perform this task okay and we will create the distinguished application in end Okay so uh let me go back to the vs code so these are the requirements that we need okay that open AI if to interact with the apis on open Ai and then we need a Spacey to perform named entity recognition and we also need World cloud and nltk natural language toolkit okay so if you haven't used open AI apis yet you know what you have to do you have to go to this platform.openai.com website and you have to create an account or you can also sign in with your social accounts like Gmail for example you can also use your Google account to log in with login into openai platform and once you've successfully logged in you can go to this option called view API keys and then you will find out some of the apis listed over here okay they also have an option called playground where you can play with you know some of the examples like if you see the loader preset where they have a lot of examples already there for you you can test it out like they have q a they have classification if you want to classify text between you know maybe positive negative or neutral you can also do question answering on your text Data okay so this is the playground that you have and what we are going to do we are going to use this model text DaVinci 3 so danishi 3 is the most capable model I have couple of other videos as well where we have used WC3 to create some kind of applications you know simple applications like readme generator or minutes of meeting generate generation using gaming C3 it is it is I think based on instruct GPT okay and very powerful uh when you compare to other models like Ada or bad ways of query right and we are going to use their API to perform this task like finding out key insights and summaries and most positive words and then we'll use Spacey for n here so let's uh go back to vs code and I will create a file called app.pi so here we will write our python code we'll write the code for streamlit and all the functions that we need you know to perform this task and first of all we have to install these requirements uh open AI space C string lead and how do we do that so if you go back to the terminal I have already installed what I will do I'll first activate my virtual environment so I have installed all these you know dependencies inside a virtual environment it's a good practice to install libraries in a virtual environment so you don't uh you know mess with the other projects that you have right due to some version conflicts and so Python 3 I want Ubuntu and then what I will do I'll just say I have to go into CD dot V and B which is another folder name of my virtual environment and then on Ubuntu I have to do bin if you are on Windows you have to do scripts and then what I will do Source activate to activate that virtual environment when I hit the source activate you will see that I have V and V activated now okay so I'll just do couple of series order to get go to the main directory and you'll see that I am inside this text analytics folder and I'll just clear it out and here we will uh you know here we will install and run our code okay so if you haven't installed you have to do fifth three install hyphen R and requirements.txt to install all these libraries you know we have all these libraries over here we need python dot EnV because we would like to keep our credentials or the API Keys the open AI API keys inside this EnV okay it's a good practice as you should not you know show these API Keys when you are you know deploying in the production or if you are pushing your code to GitHub right so that's why we use this EnV files to store our sensitive data and then we have word cloud to generate the word cloud we will talk about it in a bit so you can install it with this command I'm not going to install that now what I'm going to do I'm going to uh create that app.pi file here and once I have app.pi I will start writing the code so import stream list add HD and stimulate is the most powerful uh wave like wave framework I'll say it's a library in Python that you can use to you know create powerful applications if you haven't used streamlit you know you can go to extremely documentation this is a stimulate and you can come over here that's their website which is a faster way to build and share data apps they also provide you Cloud where you can deploy your streamlit applications if you haven't used simulator you can also look at the other video that I have created in past and I also have created a video whereas where I have shown that how you can deploy the HTML application in free okay so go on docs you can find out all their HTML documentation over here you can see the documentation we have over here so what I'm going to do now I'm going to let me just bring up my monitor so yeah so the first thing we need we need to uh have an input area where we'll input our text okay so the first thing that okay let me do import stimulatizes T and how you can write uh or create estimate application uh very fast okay it's very fast and it's very easy for prototyping if you have some models you want to do the inferencing if you want to create a prototype you can easily use the streamlit right so very simple functions to use so first is s0. title where I like to give a title to my you know application and then I can call it you know gpt3 powered GPT to three power text analytics app so I can call this h0 title and now let's do one thing let's just save it and run this how do we run a an estimate application it's very simple so what we do we say streamlit run app.pi which is the file name so if you see my file name is average price I'm just doing extremely to run app.5 when you hit enter it will give you a network URL and it will redirect you to localhost 8501 automatically in the browser so you can see this is the title gpt3 uh Power text analytics app this is going to be our app name okay or the F title so uh let me just do one thing so as I said we need a text area Okay where we will enter the text and how we can do that so let's Define a variable called input text and in this input text what I will do I'll use the text area function uh they have text input function as well which is kind of a single line or single sentence but I need a text area where I can enter multiple lines or multi lines right so SD text area and I'll say here I enter your text I'll just assign the label so enter your text that's it and now if you go back to the browser you just have an option called rerun so if you click on the rerun it will load you this input box enter your text okay so if you are if you can see it uh carefully here we have this Insider container okay if we have uh knowledge of you know web Technologies so there are containers and container fluids right if you see it's in the middle of the app middle of the tab or the browser that we have this resolution if you see it over here right what we can also do we can utilize the full width of this window okay so suppose if you for example if you don't want to keep this in container or container fluid you know you want to utilize the whole area you can also do that how do we do that so let's do that so that would be your first line I mean in your instrument application we have to use this SD dot set page config so if I do set you see this option set page config and here we are going to use the layout parameter and that will be your width so I'm going to say white and this would be your first line in your stimulate application if you are writing it so SD dot title gpt3 power text analytics app now let's go back to uh this and now you can see we are utilizing the full width gpt3 power text analytics app and enter your text okay so so far we have this interview text option and gpt3 power text this is the title this is the kind of a label and then we have this text area let's have a button now we will call it analyze text button then what we do we come here and say hey if SD dot button and we call it analyze text what we can also do let's do not do that okay we first need to check if there is any value inside input text okay we do not want to hit the button without any value so what I'm going to do let's call it let's check that so what we are doing here we are saying if input text is not none and inside that we will have our button so we'll in if if St dot button let's call it analyze analyze text that's it and for now I'll just do a pass here so let me just do pass okay perfect and if you come I'll do a reader now you see we have this option enter your text and then analyze text good so what we are going to do guys we are going to use some of the text from the internet let's use this uh article from Republic world.com uh where I found it this article that you know Prime Minister Modi on Air India air birthday reflects deepening ties between you know India and France this is a very recent article there's been a trade deal that has happened between you know France and India you know uh where we are where India have you know kind of got around 200 or 200 odd aircraft right they have signed this deal so I'm going to just use this okay so for now if I just uh come over here and just paste it and turn it with India from and let me just paste this so we can take this entire content also let me just take it few of the lines from there you can take any other text as well so let me just take take this text paragraph Ctrl V and this and let's take up to this or maybe we can also take this line till the starter group perfect so suppose for example if this is our text okay this is some of the text or article or content that we have okay now we want to analyze this text and we want to find out some key insights okay what this text is all about we are finding we can find it all the positive words or the insights or the you know the word cloud that we have to create for the visualization you can also find out a summary because there are a few other paragraphs we have more than two paragraphs now if you want to make it concise in a single paragraph how we can also summarize it right so if you see this kind of uh news articles you see a lot of media houses like in sort for example in India where they kind of provide you a very crisp news a summary of news article and they have their USB in that okay so similarly we can also create something like that so if you see this analyze text now what I'm going to do it's very difficult to read this so when we click on analyze text we'd like to read this as well okay so how we can do that okay so let's first uh read uh present this text the input text and we can do that through a status message so if HD dot button analyze text what I'm going to do now next if you dot markdown so if you haven't used streamlined yet or if you have limited knowledge so streamlined kind of supports markdown okay and where you know you can create documentation or you can write the text inside a markdown format as well so I will have HD dot markdown and in that asteroid markdown I'll have I will write your text now your text and then here I'll use St Dot info for example and in if your info I'll have input text I just want to present that so we can read it what we uh what we have entered as our text and sd.info now let's do let's see that if you have the option read on every run it and I'll hit the button analyze text what it will do it will give me this uh option where I can read it so we have used in a status map status message you can also do acid dot write extremely dot right where you know you can just get it as a pure text like it will print you on this stability y so HD dot write works the same way where we have print function in Python so the same way but I just do not want to do that I want to do that in this way where I like to use that in my status message where you have SD dot info you have SD dot warnings you have HD dot errors and you have HD dot success okay so now this is the text now we want to analyze this stick and this this text can be anything you have 100 or 500 words or you have an article you can also have a file uploader and use some libraries to use that doc or docxo PDF like Pi pdf2 or PDF finder or PDF plumber and you can get the text out of it so this is just for the capability is to see that how we can use gpt3 to find out some key insights and how you can use couple of libraries with gpt3 to come up with some of the insights okay on this estimated application so if you see your text area we have your text in this input text area we have entered the text and now we are getting this your text now the first thing like what we like to do is to write the function now okay let's write the function to generate the inside so I will go back to uh vs code and here I will start writing the code so first thing what we need we have to first import some of the libraries and then we also have to define the constants okay like the API keys and some of the others the first thing is uh what I'll do I'll import space c so I'm importing spaces here and uh okay I'll do that uh these are we need this core wave SM small they also have large LED and you can down you can load you can also download it keep it in the folder and you can also if you load it from here okay you have to install it through the python command it downloads it and keeps in the local cache okay we need it to these are all pre-trained okay any space c okay so import space c and now what we have to do uh we also have to import open AI because we are going to use open Ai and we once we import open AI we also have to import uh okay let me first do one thing from space c we also have to import something called display C where we have to show this in a visual form the name entity recognition Okay so space c from a space c import display C and we have import open a now what you can also do after input open AI we can also do uh from word cloud because we need to do word cloud so from word cloud import Cloud okay from WhatsApp so it will use word cloud so word cloud is nothing but the visual representation of your entire tags or the text that you have it kind of try to find out all the most emphasized word or the most you know repetitive or unique word or as well now you can also customize it if you want to eliminate stock words you have some list defined some custom list you can also customize this word cloud completely you can go go through their documentation there are a lot of you know videos already available for you know World Cloud so we are going to keep it simple we're not going to customize this we'll just use this as a default so from word cloud import word cloud and then we also need to import some of the utilities so import OS and import Rejects import free and yeah so input OSF also import Json if you need that to handle the open AI result so import Json this one and now what else we have to do we have to also need to handle this EnV so load dot EnV so what we have to do let's import that so from dot EnV excuse me load dot EnV okay and now here what we will do guys we will first needs to Let's so we have one of the constant NLP where we are loading this uh that will be your concept we're not going to change these values or change this thing so first thing is let's set up the open a i EnV open AI API keys so I just can do this this looks good okay so if you see this what are we doing this right now I'm using tab 9 guys tab 9 you know it's kind of an auto code completion uh plugin in vs code it's kind of work same way with like kite or GitHub copilot not that capable as GitHub copilot very Advanced but you know you can also use tab 9 it kind of helps you write code faster so what we are doing we are we are using this uh method load dot EnV and then we are getting this open AI dot API underscore key and guys this is this is important so this is nothing but the name that I have kept inside this EnV file this is my name if you are keeping it something else you have to keep it accordingly okay now I have set up my open AI API Keys okay this is and this is also done NLP now let's write the function the first functions would be you know for basically the let's write it Forward cloud function code generating the word Club this is going to be the first uh function and I'll call this function forward cloud and what it says it says it's suggesting me that generate workload input text background color white maximum generate HD dot image word cloud okay let me hit tab we can make these changes and now uh I don't like to keep this background color as white what I have to do I like to prefer a black background for my world Cloud which is basically nothing but the image and then we have maximum world and maximum font size so what I'm going to do I'm going to use uh a couple of other functions because a couple of other parameters as well so I also have you know minimum font size that will be let's call it 10. let's do this okay so it will be or alt G if I do alt G okay so we have generate word cloud input text uh and this is okay doc NLP input text word cloud equals to word cloud background color equals to Black okay and maximum words like okay this is the maximum word 1000 okay this this would be my limit uh and then maximum font size okay that the words font that we have it's not to be more than 100 pixels if I'm not wrong this is all pixels and this minimum font size 10 and then generate and then I have this variable dot okay this is what we are doing now what we can do guys okay let's I don't want to use this HD dot image here I want to save this word cloud locally so I'll say word cloud Dot not to save we'll say two file I'll use this two file function and here I will use this file name which is nothing but the word cloud dot PNG okay let's call it an PNG and then I will do a return word cloud dot PNG return word cloud.png but this is a string okay now let's so this is our function for generating the word cloud so generate word cloud input text this is a ask that we have and then we have doc NLP input text and yeah so this is good but this will not be NLP okay I don't think we need this okay so what we're going to do let's remove this we do not need it and let's just pass the text as it is input text but we can also give some of the parameters okay excuse me let me just uh this input text yeah we have this input now we can also pass some of the other thing like width and height how uh what should be your width and height of the image that we are getting okay so let's call it 800 and 800 so the first thing is Google and this should be 800 and then I have the height it should also be 800 okay so I need 800 cross 800 image okay background color black maximum word thousand let's remove this maximum words do not need right now let's not keep any limits okay maximum font size 100 minimum font size 10 and generate input Tech this looks good okay so now what we can do how we can visualize this guys this so here you see we have H dot info input techno let's go back to the UI ones so estimate also provides you an option where you can divide the page that we have or the UI that we have in or the layout basically let's call it layout so it also gives you an option to divide the layout okay set the layout through columns now if you want to use two or three columns here you want to divide this you can also do that so how we do that so the first thing is let's divide into three column so first I'll call it like this so this is done I will head back here and uh excuse me not this here I'll say column one column two and column three there are three columns I need and I'll call it HD dot columns I'll have this function within the function I will need a list and then I will categorize this I will set the layout accordingly how much weight is that I want to keep so if I want to categorize this one two and one and I'll explain that why I'm taking one two and one so excuse me column two will have more width and column one and column three will have same width okay so it will be twice the width of one and three the column two that we will show our world Cloud because that's an image we need to show it in a like a good height and width resolution right so this is column one column two column three now let's do one thing let's write for the column one the first thing is with column one image generate word cloud input text already took the function for now I'll just call it pass okay let's keep that image word cloud in column two where we have to floating column two so we have to pass that word cloud function the generate workload function on this input tick that we have so how do we do that so for that we'll use this first let's write a markdown so HD dot markdown and I will not call it your text I'll call it World cloud so this is going to remember my word cloud and and here I will write the function I'll use the function St dot image this is our function generate word cloud and the variable where we are storing this uh text that input text now let's run that and see if we are able to get the desired response in this case everything looks good so far okay let's run it and I'll just hit the analyze text so you can see we are getting this watch Cloud right uh very A Beautiful World cloud and we have a dark theme for this word cloud if you keep this you know option of background color as white you will get this word cloud in a white background if you have completely customize it it has a lot of arcs and params that you know you can tweak it so if I go back to this UI you can see that we entered our text first and then we presented that text inside the status message like this info and then we are generating this word cloud guys okay with the help of world Cloud Library and you can find it out they are talking about you know security Aerospace Aviation and they're also talking about you know Prime Minister Modi Tata group France and all this most worse in a visual way right we are getting a visual representation of this entire text that we have so you see this is the middle of the layout that we have set and we have option here you see this is the that we divided into one two and one this is the twice of this right the First Column and the third column now in the First Column guys we'll use we'll try to you know see if we can use open AI API DaVinci 3 Model to generate some key insights and you know in in this column three we'll find out the most positive words now let's go back to vs code and start writing the code we'll write the function for you know function to gen uh function to derive key insights using open AI gpt3 apis jp3 models for now okay so we have already uh used dot EnV where we have a kind of set up our environment Keys the API Keys using this environment now we'll just write that so let's call it diff and generate key inside we do not need all those things they are using this tab 9 is showing me this Rejects and all we don't need it so we'll have an input text and here what we're going to do guys we are going to uh first use this same thing so response and then here let me just show you one thing so what we can also do guys let me go back to this Playground now I'm on this playground what I'll do I'll say hey please derive key insights from the below tip and let's do one thing please derive key insights in the maximum of five bullet points okay this is my prompt that that I am sending it to gpd3 ravishy 3 model this is why I'm doing the prompt engineering so please derive key insights in the maximum of five bullet points from the below text now what we can do we can come back to this streamlit application we'll copy this text we'll go to playground this is nothing but the playground I will hit this and this is my text and I'm I'm asking DaVinci 3 Model to give me the key insights out of it and I'll just say submit so you can find out some of the parameters here we have model selected as DaVinci 3 we have temperature as 0.7 we have the maximum length as 256 and we have some other parameters like penalties and top p and all those things and let's submit that once I submit that you can see that I am getting these findings you know which is currently in the green label in few seconds it will be like the same so you can see I'm getting these key insights in five bullet points in math and we're talking about you know PM Modi and French president macron launched the new Air India Airbus partnership the deal reflects the deepening ties you know between India and France and the make in India scheme and making World scheme of Prime Minister Modi right so what you can also do why I'm showing you this okay if you have no idea that how to you know integrate open AI apis in a python application they also give you an option called view code okay so if you click on that view code you can see that they you can also do a post request directly if you have your account on open AI dashboard okay you can do a post request request and of course you need this API key that you will get it from this uh dashboard here let's copy this code what I will do I'll copy this and I will come back here on uh generate key inside I'll just paste it and once I pasted it I will remove all this I don't need all these things okay these are all my texts that I've pasted it there okay let me just remove it you see I have removed it right so now let me explain so we have this open air we do not need this import we already have imported I think we need OS as well we have OS very good and now let me just do the indentation here and I'll do a tab perfect and let me remove this it also not do not need this thing so the guys first thing is the response okay we need this completion engine okay with nothing but the model that we need to you know uh use so if you are using the default model from open AI dashboard you have to give this domination 3 if you want to fine tune the already existing model on your custom data you can also do that and in that case this model name will be changed accordingly then I am doing the prom very simple prompt engineering I have a prompt that okay please derive key insights in the maximum of five bullet points from the below text and here what I will do guys I'll have this input text here now I have this input sorry not interrupted error this is what happens when you use this in Auto completion plugins okay so input text so this input takes as a parameter that I have in this in this function I am just passing it here now with this prompt and I have some I'll keep this as default temperature basically this is for creativity and Randomness you know in in your answers and Max tokens like you know setting up the maximum limit of the tokens tokens are basically uh not exactly the words but I think four uh letters kind of combines and we call it as a single token okay and then we have couple of frequency penalty that if it's based on reinforcement learning right so uh and in the human feedback loop that we have to set all these parameters to get the best out of damage C3 or any other gptc models so if you see that we have generate key insights and this is a function now what we can do guys we have to this function is still not complete okay we have to return so now let's return this return response to as text the first one and the text okay I only need the text and that to the first one the choices so this is the return and this is coming again from that uh Guys open AI that we have over here that we are using this from the playground so if you come back we have we have already written the function for generating the key inside but how we can use this okay uh let's use this so what I'm going to do now we have returned we'll come back here and we'll use uh in the same way okay and but not here in the column one so in column one we like to you know use this so firstly HD dot markdown and I think this makes sense HD dot info let's call it success so let's use this uh function of streamlit success and generate key inside I think this is the function name as well generate key insert perfect and then we have passing the variable here and this is the key inside the markdown let's run the code and see if you are able to get the desired response I'll hit that analyze text again so here we go guys you can see the key inside that we have the same key inside in the five pointers that we we have done the prompt engineering so this was my text enter text you can read it over here that you know is talking about prime minister is talking about you know this the trade deal that they have done with France okay uh for this aircrafts and we are generating the key insights out of it okay let's let's call it by the way uh key insights not inside but I'll just save it I'll not run right now so the first one is Air India and Airbus have entered into a landmark partnership the partnership reflects the deafening ties between India and France and the deal will expand air India's Fleet and operations with the addition of 250 aircraft including 40 wide body aircraft and a deal is the first order placed under attack groups ownership of Air India in 17 years and PM Modi has emphasized the make in India make for the World Vision that we have right uh which is creating many opportunities in Aerospace manufacturing this Fanta this is fantastic right and this is what we have you know generated from this text that you that we have right so key insights now what we can also do apart from Key insights we can also find out the most positive word okay now if you want to find out the positive words that you know have been published in this text news that we have read this news article over here okay so let's do that so how we can do that as well let's go back to the code again and here we'll write the function so I'm writing it function to you know uh generate function to generate not DNA function two function to find out the most positive word in the text in the tip using domain C3 003 and here we'll write the function so Define gate most positive words and again the parameter input text and here we write the same thing so let's use the same thing over here I'll just change the prompt so I'm just going to use the same function and here I will not use this prompt here please derive key insights in the maximum of five bullet points rather I will say hey um bullet this will be the same I just change this please find out the most positive words in the below text this is going to be uh my function and the prompt for this particular task and I will go back and I will use this column three now so how we can use this column C with column three you can see it's tab 9 is already suggesting me so same way we are using this markdown where we have this you know label most positive words and then we are using this function to uh get this most positive words now let's run that so you can see we also got most positive words here okay so if you see this option in the column that we are reading so these are the column one column two which is twice the width and height of this column one and column two so this uh column three we have most positive words in most positive words we are getting it reflect successes and aspirations and we are talking about vision and you know in purchase and aircraft these are the most positive words in that uh text that we have above here you can see this so we all we are all this getting that you see this key insights and most positive words with the help of gpd3 okay and this we got with the help of Word Cloud Library basically to you know represent it in a visual way now what we can also do guys we can also you know uh do this name entity recognition we can perform this with the help of Spacey uh named entity recognition let's do that how we can also do this named entity recognition thing here so I'll go back and write the function here for that name entity recognition and I'll call function to function to perform ner using space c this is what I'm going to do function two so space c is a very powerful natural language processing library is one of my favorite libraries I've been using it for years now in at my workplace and uh even on the Enterprise scale Solutions is extremely powerful you can also fine tune a lot of pre-trained Spacey models on your data as well you have your custom data you annotate and you perform natural you know named entity recognition you perform some other tasks like you know fuzzy matching or keyword matching and some other tasks as well it's extremely powerful you know and so I think that also is their version three okay especially version three you can also use that so what I'm going to do guys I'm going to use this any RF uh thing I'll call it in ER named entity recognition and I will have my input text over here again and here I will write the code for performing this name entity recognition the first thing is we have to use NLP dot you know NLP equal to foreign this is very important because if streamlit also provides your library called especially streamlit okay you can also use that so I will not use that I will keep it uh very simple from scratch that we do with the help of Spacey already so we are going to use something called display C where we will you know visualize this named entity recognition you know in a very beautiful way that you will see so let's do that so we have Dock and now we're going to do HTML okay that variable and that will use this place here so what I'm going to do display dot render and here in display.render what you need to do uh now I'm going to use this Dock and then the style so we have we have a couple of style here in which way you want this entity so the first is entity we have some others as well so style equal to end I need any entities with N Style and then we can also use a couple of other parameters if you are doing this in a Jupiter notebook how you can also do it guys that uh you can use this parameter called Jupiter equals to true if you are trying to get this name edit recognition in a visual way using this place you have to do it true or false so for this case I will keep it false that I don't need it now if I just return this HTML I will not be able to get the desired response okay because extremely don't provide that right now like this you can use specific streamlit library to do that so what I have to do okay let me first do one thing okay and I don't know I want to remove this line breaks okay if we have multiple line breaks we can also remove that so let's do HTML dot replace and in HTML dot replace I'll replace this with not single a single line break if you have multiple line breaks so with single this this is okay and now HTML HTML dot replace this is okay perfect HTML display and now let's do one thing now how would you visualize this okay so for visualizing what we have to do we have to basically use this I have this gist in streamlit I will just copy this I'll share this you know just link into it and I'll just this is the conscience I will Define it above here somewhere let me you know Define this maybe after this so let's we do not need this anymore because I think we are already using this inside the function so this HTML wrapper now what I will do guys I will just use this HTML wrapper over here okay so this is done displacement.render HTML dot replace and and here what I'm going to do I'm going to use this is HTML wrapper dot format HTML and I'll use this option HTML format you're going to use this function unsafe I'm going to use unsafe allow HTML okay so unsafe allow HTML equals to true this will be in this HTML wrapper dot format let's just do SD dot write and let's close this okay we do not need this so this is done HTML dot HTML underscore wrapper dot format and I think this is the this is done for name entity recognition HTML wrapper dot format htmlower now what we can do let me just remove these places uh come back here and here we can write excuse me so we will not use this column anymore that three column that we have divided if you come over here on the app we have this three columns this is already occupied so we'll visualize this or we'll perform this named entity recognition task over here in the below section and then it will look a little nice as well okay so this is what we are going to do okay so if I come back here I'm going to do HD dot markdown first and in this HD dot markdown I'm going to again use the same thing named entity recognition recognition I think this is misspelled yeah and here I will use that function okay any R input text this is what I'm going to do so I think this looks nice or we have let me just check the function once again so HTML wrapper in this HTML wrapper what we are doing guys we are using this if you see we have some border we have some radius and we have this basically so deep style and HTML diff style where we are using this unsafe allow HTML uh parameter within the stimulate write function to allow this external HTML tags that we have to look to make it a little fancy and now let's run that and I'll hit this analyze text once you hit the analyze text you can see that we have our text over here uh that input text we have this key insights word cloud and this most positive words that will see that you know positive words that we are getting it says got an unexpected keyword argument Jupiter okay let's do one thing let's go back to Jupiter let's remove this Jupiter equal to false and what I will do I'll just try it again but let me just see one thing why it's saying Jupiter which is yeah meanwhile will see that okay but I think let me just do one thing let me first remove this Jupiter we'll see why we are not getting this Jupiter equal to false uh name I think I forgot to close this so named entity recognition and once you hit that again analyze text once you hit the this analyze you can see that's running over here okay but let me go back to this terminal why is taking that much of time let me just Ctrl C the model is currently overloaded with other requests okay let me just do one thing let me rephrase this terminal and paste the text analyze text again you can see that we received our your text uh that again here in this visual uh this status message and we got the key insights the first thing in the column one and the word cloud and the most positive word if you see the key insights we are getting as it is the word cloud and the most uh positive word and here we are getting this named entity recognition now we'll see the name entity recognition that we you know we are using this PC to do that it kind of you can see some of the labels there labels with different colors right we have this person if you see person like macron or uh Prime Minister Modi and we're also talking about some facts we are talking about some organizations like Air India or air burst we also have gpe which is nothing but the geography so we have India France so this is very helpful guys name entity recognition if you want to extract some information some you know entities okay from your text Data the unstructured text Data you can also sort it out now for example imagine if you have plethora of documents okay on the use abundance of text Data where you want to find it out all the person's name okay you can just use this function you can sort it out with the help of person you have this ENT we are using this if you come back over in the vs code you know we have this style equal to end right you can sort it with the end and you can pass this you know inside a list of the person name you can get all the person you can get all the organizations all the gpe and the Cardinal values are the numbers you can also annotate your own data okay with the help of a lot of text annotated tools now for example if you want to extract like restaurant name or if you want to extract like your software's name you know inside text document or python libraries name inside or API or documentation or manuals you can also text uh use that text annotate that text and then fine tune on the Spacey models okay train it and then you can also use it the same way so you can see that we have got this named entity recognition on this input text so what we did in this video if you see this we we have created an application stimulate application gpt3 power text analytics app we are giving a text input and we are deriving some key insights we are also getting some most positive words we are getting this word cloud which is nothing but the visual representation of your entire text data or text and then we have this name entity recognition where we are doing this performing this ner with the help of Spacey right so this is what you know we wanted to do in this video guys and I think we are able to get desired response now you can also extend this you can also add sentiment you know you can also use text blob or any other weather sentiment or any other libraries to perform you know sentiment analytics on this text data so you can also find out the summary I think that will not be that difficult to do let's try that as well let's see if we can try that so please derive key insights in the maximum of five bullet point and I'll just use and uh generate summary okay Within three sentences from the below text now I am adding this you know extra you know feature there I like to get the summary as well okay now let's see if we are able to get that okay uh using gpt3 so I'll just again hit the analyze text and now you start again start they started you know analyzing this text okay first it will will get this your text and key insights I think the it's it's being overloaded but anyway you can see we are getting these key insights and we also got this summary guys if you see detail summary now that we are we are getting the Air India Airbus partnership launched by PM Modi reflects the ties between India and France and so earlier we were getting this key insights and we're also getting the summary in it okay so you know you can again use the sentiment we have the classification preset in gpt3 if you come back over here on the playground okay let me close that you can also do that if you see this classification so we are getting key inside somebody's world Cloud most positive words and this name entity recognition so in this video we created a very simple application on a very small uh text a couple of paragraphs and we derive this these insights okay with the help of gpt3 word cloud library and SPC libraries if you want to try this if you want to extend or add something in this application you will get the code here on the AI anytime GitHub repository you can see this gpt3 power text analytics app and guys uh if if you want to do a pull request if you want to add or make any changes please do that please uh do a pull request and we'll also see how we can extend this you know application so if you are liking the content you know I'm creating please like this video and please also subscribe the Channel please you know share this video and the Channel with your friends and to the peer you know so thank you so much for watching this video guys see you in the next video

Original Description

In this video, I've created a Streamlit application using advanced technologies like GPT3 and Python lib. like Spacy, and WordCloud. This app is designed to help you extract key insights from text/content, making it an invaluable tool for your development projects. The app features several functions including generating a word cloud, generating a summary, extracting key insights, identifying the most positive words, and performing named entity recognition. With its user-friendly interface, this app is incredibly easy to use. Whether you're a developer who is looking to build an app for researcher analyzing a large corpus of text, or a content creator looking to identify key themes in your work, this type of application can help you start in the right direction. GitHub Repo: https://github.com/AIAnytime/GPT3-Powered-Text-Analytics-App Streamlit Documentation: https://docs.streamlit.io/ Open AI GPT3 API: https://openai.com/api/ #python #nlp #streamlit #gpt3 #ai #machinelearning #generativeai #chatgpt
Watch on YouTube ↗ (saves to browser)
Sign in to unlock AI tutor explanation · ⚡30

Playlist

Uploads from AI Anytime · AI Anytime · 16 of 60

1 Spelling and Grammar Checking Streamlit App: Building Docker Image
Spelling and Grammar Checking Streamlit App: Building Docker Image
AI Anytime
2 Spelling and Grammar Checking Streamlit App: Docker Image and Docker Hub
Spelling and Grammar Checking Streamlit App: Docker Image and Docker Hub
AI Anytime
3 Image Caption Generator: Google Colab and Hugging Face
Image Caption Generator: Google Colab and Hugging Face
AI Anytime
4 Low Code/No Code AI Platform Teachable Machine: Brain MRI Image Classification
Low Code/No Code AI Platform Teachable Machine: Brain MRI Image Classification
AI Anytime
5 Low Code/No Code AI Platform Teachable Machine: Testing the Model
Low Code/No Code AI Platform Teachable Machine: Testing the Model
AI Anytime
6 Low Code/No Code AI Platform: Streamlit App for Brain MRI Image Classification
Low Code/No Code AI Platform: Streamlit App for Brain MRI Image Classification
AI Anytime
7 Readme Generator Streamlit App using ChatGPT
Readme Generator Streamlit App using ChatGPT
AI Anytime
8 Generate Minutes of Meeting (MoM) from Video using ChatGPT: AI as an API
Generate Minutes of Meeting (MoM) from Video using ChatGPT: AI as an API
AI Anytime
9 The Great AI Showdown: ChatGPT vs ChatSonic 🔥
The Great AI Showdown: ChatGPT vs ChatSonic 🔥
AI Anytime
10 Generating Transcripts and News Article with Whisper, GPT-3.5, ChatGPT and Streamlit
Generating Transcripts and News Article with Whisper, GPT-3.5, ChatGPT and Streamlit
AI Anytime
11 Toxicity Classifier using Machine Learning and NLP
Toxicity Classifier using Machine Learning and NLP
AI Anytime
12 Toxicity Classifier API using FastAPI
Toxicity Classifier API using FastAPI
AI Anytime
13 Toxicity Classifier Streamlit App
Toxicity Classifier Streamlit App
AI Anytime
14 Low-Code Insurance Prediction with PyCaret and Streamlit
Low-Code Insurance Prediction with PyCaret and Streamlit
AI Anytime
15 Deploy Streamlit Python Application for Free
Deploy Streamlit Python Application for Free
AI Anytime
GPT3 Powered Text Analytics App
GPT3 Powered Text Analytics App
AI Anytime
17 AI Image Generation Streamlit App
AI Image Generation Streamlit App
AI Anytime
18 Streamlit and txtai: Building an Abstractive Summarization App in Python
Streamlit and txtai: Building an Abstractive Summarization App in Python
AI Anytime
19 Building a Topic Modeling and Labeling app with Streamlit
Building a Topic Modeling and Labeling app with Streamlit
AI Anytime
20 The Art of AI: Exploring Midjourney, Dall-E, and Lexica
The Art of AI: Exploring Midjourney, Dall-E, and Lexica
AI Anytime
21 Exploring the latest Large Language Models (LLaMA and Alpaca)
Exploring the latest Large Language Models (LLaMA and Alpaca)
AI Anytime
22 Comparing LLMs like GPT-X, LLaMA, and Alpaca: Analyzing the Perplexity Score
Comparing LLMs like GPT-X, LLaMA, and Alpaca: Analyzing the Perplexity Score
AI Anytime
23 GPT-3 powered Q&A App using Langchain, GPT-Index, and Gradio
GPT-3 powered Q&A App using Langchain, GPT-Index, and Gradio
AI Anytime
24 All things #ai . Latest and greatest in AI. #tech #python #chatgpt #youtubeshorts #shorts #gpt3
All things #ai . Latest and greatest in AI. #tech #python #chatgpt #youtubeshorts #shorts #gpt3
AI Anytime
25 Text-to-Video Generation using a Generative AI Model
Text-to-Video Generation using a Generative AI Model
AI Anytime
26 #ai brand name generator. #artificialintelligence #tech #shorts #youtubeshorts #youtube #chatgpt
#ai brand name generator. #artificialintelligence #tech #shorts #youtubeshorts #youtube #chatgpt
AI Anytime
27 Talking AGI with Sam Altman: A Deepfake Showcase
Talking AGI with Sam Altman: A Deepfake Showcase
AI Anytime
28 A conversation with ChatGPT creator Sam Altman. #tech #technology #ai #shorts #viral
A conversation with ChatGPT creator Sam Altman. #tech #technology #ai #shorts #viral
AI Anytime
29 Get to Know Anthropic's Claude: The Ultimate ChatGPT Competitor
Get to Know Anthropic's Claude: The Ultimate ChatGPT Competitor
AI Anytime
30 #shorts #chatgpt #python #datascience #tech #coding
#shorts #chatgpt #python #datascience #tech #coding
AI Anytime
31 Recipe Generator App from Cooking Videos using Whisper and ChatGPT
Recipe Generator App from Cooking Videos using Whisper and ChatGPT
AI Anytime
32 Segment Anything Model by Meta AI: An Image Segmentation Model
Segment Anything Model by Meta AI: An Image Segmentation Model
AI Anytime
33 One of the best #ai #books based on #tensorflow. #tech #coding #shorts #chatgpt #machinelearning
One of the best #ai #books based on #tensorflow. #tech #coding #shorts #chatgpt #machinelearning
AI Anytime
34 Music Generation using Mubert #ai . #music #shorts #youtubeshorts #chatgpt #generativeai
Music Generation using Mubert #ai . #music #shorts #youtubeshorts #chatgpt #generativeai
AI Anytime
35 Image to Text Prompt: Reverse Engineering AI Image Generation
Image to Text Prompt: Reverse Engineering AI Image Generation
AI Anytime
36 Image Generation for #ramadan using #ai. #midjourney #chatgpt #shorts #youtubeshorts #islam
Image Generation for #ramadan using #ai. #midjourney #chatgpt #shorts #youtubeshorts #islam
AI Anytime
37 How to build an AI-ready organization: Cultivating a Data-Driven Culture
How to build an AI-ready organization: Cultivating a Data-Driven Culture
AI Anytime
38 Midjourney: Generate AI-powered Images
Midjourney: Generate AI-powered Images
AI Anytime
39 Getting Started with Graphs: A Beginner's Guide (Part 1 of GNN Series)
Getting Started with Graphs: A Beginner's Guide (Part 1 of GNN Series)
AI Anytime
40 Build India's First ChatGPT like App for Politics: BJP-GPT
Build India's First ChatGPT like App for Politics: BJP-GPT
AI Anytime
41 Meet BJP-GPT.... @AIAnytime  #bjp #news #shorts #tech #chatgpt #ai #youtubeshorts #coding #video
Meet BJP-GPT.... @AIAnytime #bjp #news #shorts #tech #chatgpt #ai #youtubeshorts #coding #video
AI Anytime
42 ChatPDF... #chatgpt  for PDF files. #ai #generativeai #shorts #youtubeshorts #coding #tech #ai
ChatPDF... #chatgpt for PDF files. #ai #generativeai #shorts #youtubeshorts #coding #tech #ai
AI Anytime
43 Free AI Image Generation #ai #chatgpt #coding #tech #shorts #youtubeshorts #shortvideo #generativeai
Free AI Image Generation #ai #chatgpt #coding #tech #shorts #youtubeshorts #shortvideo #generativeai
AI Anytime
44 Transform old photos into Vibrant Memories with Deoldify AI: Build a Streamlit App
Transform old photos into Vibrant Memories with Deoldify AI: Build a Streamlit App
AI Anytime
45 Open Assistant: The Real Open-sourced LLM
Open Assistant: The Real Open-sourced LLM
AI Anytime
46 Thanks to @YannicKilcherand team for the open sourced LLM Open Assistant. #ai #shorts #tech
Thanks to @YannicKilcherand team for the open sourced LLM Open Assistant. #ai #shorts #tech
AI Anytime
47 Search Engine for AI generated images. #ai #tech #technology #generativeai #chatgpt  #shorts #video
Search Engine for AI generated images. #ai #tech #technology #generativeai #chatgpt #shorts #video
AI Anytime
48 Generative AI Video Platform "Synthesia" #shorts #youtubeshorts #ai #tech #chatgpt #generativeai
Generative AI Video Platform "Synthesia" #shorts #youtubeshorts #ai #tech #chatgpt #generativeai
AI Anytime
49 Text to speech Voice AI platform. #shorts #youtubeshorts #ai #tech #technology #python #coding
Text to speech Voice AI platform. #shorts #youtubeshorts #ai #tech #technology #python #coding
AI Anytime
50 Create Amazing Videos with ChatGPT and Pictory: Free AI-powered Video Creation
Create Amazing Videos with ChatGPT and Pictory: Free AI-powered Video Creation
AI Anytime
51 Want to create beautiful video using #chatgpt and #pictory ? Watch the tutorial on channel. #ai
Want to create beautiful video using #chatgpt and #pictory ? Watch the tutorial on channel. #ai
AI Anytime
52 Animate your photos using AI. Bring old family photos to life. #ai #tech #shorts #shortvideo #coding
Animate your photos using AI. Bring old family photos to life. #ai #tech #shorts #shortvideo #coding
AI Anytime
53 Create a PDF Search and Summarization Tool in less than 100 Lines of Code: GPT-Index and Streamlit
Create a PDF Search and Summarization Tool in less than 100 Lines of Code: GPT-Index and Streamlit
AI Anytime
54 Text to Video Generation using Videocrafter: Intuitive Math behind Latent Diffusion Model
Text to Video Generation using Videocrafter: Intuitive Math behind Latent Diffusion Model
AI Anytime
55 Gamma AI: Create presentation PPT easily with #ai . #chatgpt #shorts #shortvideo #tech #coding
Gamma AI: Create presentation PPT easily with #ai . #chatgpt #shorts #shortvideo #tech #coding
AI Anytime
56 Tripnotes: Free AI tools for your trip planning. #ai #chatgpt #shorts #youtubeshorts #video
Tripnotes: Free AI tools for your trip planning. #ai #chatgpt #shorts #youtubeshorts #video
AI Anytime
57 Meet Bark (New Text to Speech Model): Clone Any Voice to Generate Music and Speech
Meet Bark (New Text to Speech Model): Clone Any Voice to Generate Music and Speech
AI Anytime
58 Fliki: The free AI video creation tool. #ai #shorts #shortvideo #youtubeshorts #chatgpt #tech #news
Fliki: The free AI video creation tool. #ai #shorts #shortvideo #youtubeshorts #chatgpt #tech #news
AI Anytime
59 Ask Anything Tool: Chat with Your Video using ChatGPT, MiniGPT4, and StableLM
Ask Anything Tool: Chat with Your Video using ChatGPT, MiniGPT4, and StableLM
AI Anytime
60 HuggingChat: Open Source ChatGPT (Interface and Model)
HuggingChat: Open Source ChatGPT (Interface and Model)
AI Anytime

This video teaches how to build a text analytics application using GPT3 and Streamlit, covering topics like named entity recognition, visual representation, and text summarization. The application can be used to extract key insights from text, making it a valuable tool for development projects.

Key Takeaways
  1. Create a Streamlit application for text analytics
  2. Install OpenAI API and necessary libraries
  3. Activate virtual environment and install dependencies
  4. Create a file app.py and write Python code for Streamlit and functions
  5. Use OpenAI API to perform tasks like finding key insights and summaries
  6. Use SpaCy for named entity recognition
  7. Fine-tune pre-trained SpaCy models on custom data
  8. Perform named entity recognition, fuzzy matching, and keyword matching
💡 The video demonstrates how to use GPT3 and Streamlit to build a text analytics application, showcasing the potential of advanced technologies for extracting key insights from text.

Related AI Lessons

Sub-10ms AI Workflows: Accelerating sim.ai with On-Device Semantic Search using Moss
Learn how to accelerate AI workflows with on-device semantic search using Moss, achieving sub-10ms response times and improving user experience
Medium · Machine Learning
Stop Guessing: Guaranteed Structured Output from LLMs in Node.js
Learn to guarantee structured output from LLMs in Node.js and stop parsing JSON manually
Dev.to · Hardik Mehta
Spring AI Tutorial — Your First REST Endpoint with OpenAI (2026)
Build a REST endpoint with Spring Boot 3 and OpenAI to create an LLM-powered API, leveraging the power of AI in your applications
Dev.to AI
Notes: Memory, Context, and Large Language Models (LLMs)
Learn how memory and context work in Large Language Models (LLMs) and potential improvements
Dev.to · Vladimir Panov
Up next
5 Levels of AI Agents - From Simple LLM Calls to Multi-Agent Systems
Dave Ebbelaar (LLM Eng)
Watch →