bamum welcome to my YouTube channel so today in this lengthy video we are going to create an end to end medical recommendation system or you can say medicine recommendation system using machine learning and python so this is quite interesting project and you can use it as a FIP project so this is the interface our project we will uh do a lot of things in in this project we will also create this amaz website now here we have a lot of section if you click on contact then you will be right redirected to contact Section there's a developer section uh there is a Blog section as well okay we will see all these things but currently we are at home now in home we have a simple form here you can type uh any patient symptoms like the patient has coughing oring different symptoms right now let me uh before showing the output and all the result as you can see these are the result okay these are the result let me show you the entire working process of this project so I have open uh let me show you okay so what will we will have we we will have this uh search bar okay in this search bar you will type uh any patient or any user symptoms like the patient has itching and coughing sleeping and eching this input will go to our model our AI machine learning Trend model this model will predict disease for all these symptoms let's say the disease is impo okay this is the disease symptoms according so after that this model uh will compare this disease with a database now in database we have a lot of tables like medication tables precaution tables workout tables diet table description tables each table contain a lot of information about a lot of disease but it will only take those those medication those precaution those workout those diet those description that are relevant to the predicted disease once we get all these then we will display all these results to our usern like the predicted disease name the description of that predicted disease like empo is highly contagious skin infection causing red SCE that can break up okay also we have precaution like soak affected area in warm water these are pre precaution so this entire system work works like a doctor okay when you go to doctor you show all your symptoms uh and doctor will recommend you precaution that you don't need to eat these things or you have to take care of that things like remove scabs with wet compressed cloth uh consult doctor okay so he will also give you precaution so our system do the same apart from that the doctor will also recommend you medicine related to your disease related to your symptoms okay so our recommendation system also recommend medication medication or medicine okay so for that particular disease the recommended medication will be topical antibiotics oral antibiotics antiseptics and warm compressors right and also we have workout like maintain good hygiene stay hydrated consume nut reach Foods avoid scratching and also we have died that you have to eat diet related to this specific disease and you have to eat antibiotics treatment fruits and vegetables are recommended as a diet for this particular disease hydration okay so this system will predict these things description precaution medication work out for each disease whatever the disease on the basis of the patient or model predict it will get from database all these things so let's let me show you the output so yeah so here in this select symptoms search bar you can uh type your symptoms or patient symptoms so let's say I have a patient let's say I am the patient and I'm using this AI based medical recommendation system and I have uh eing okay and I have skin R some kind of symptoms and I have cough cough is nothing but like okay so the moment I click on this button but first let me reload so that I can show you all the things uh again uh go back like this first time when you load this website it will be looks like this now here I have puted all my uh symptoms and I'll click the predict button and it will pop up all these buttons like our AI system result first if you want to just see the predicted disease then click on this disease button here you will see fungal infection we will create these things from scratch okay uh now if you want to see the description of that predicted disease so it says that fungal in infection that is the predicted disease is a common skin condition definitely because I have clearly told that I have coughing I have skin R uh and I think there was another uh eching so eching and skin R are all related to skin condition caused by fungi okay and you can also see the precautions like the doctor told that you need to Bath you need to take detours definitely AI system recommend the same thing like you have to EG B twice in a day you have to use dle or KN in bothing water and keep infected area dry and use clean clothes definitely these are quite great so also if you want to check the medication recommended medication so these are the recommended medication for the predictor disease antifungal cream definitely it's right and FL flaz tribine and clot mazol so these are all the recommended disease for that specific uh predicted disease okay now let's check the workouts here you can clearly see the workouts that avoid sugary Foods consume probiotics increase intake of garlic include yogurt so your system both prau description medication Sy doing the same okay also let's check the diet so yeah these are the diets that eat garlic coconut oil uh turmeric all these things let me show you another patient symptoms I have already you can try a lot of symptoms okay just let me copy this by contrl C and let me best try here so this is another patient who has symptom symptoms like vomiting vomiting like a okay and burning um uh burning mation or whatever it is sometime medical names are very difficult to pronounce to be honest and there is another uh symptoms spotting urination so these are the symptoms let's see what our model say so our model predicted let's see the disease so the disease is drug reaction that on the basis of all the symptoms that you have our system uh shows the patient that you have drug reaction uh let's Che the description a drug reaction occurs when the body reacts adversely to a medication perfect so let's see the precaution stop irritation amazing consult nearest hospital good stop taking drug well done follow so it's working quite good the same like doctor and I think it's more perfect than doctor to be honest medication so anti uh whatever it is I don't know how to pronounce these names but all these are true because I have searched about it antibiotics antifungal cream uh again he recommended that one so let's see the workouts uh discontinue offending medication stay hydrated include anti-inflammatory foods quite good these are all the exact workouts consume antioxidant avoid trigger foods include omega-3 flatty and eat balanced diet Etc let's check the diet so in diet it says that you need to diet anti hamine and Omega rich foods vitamin C rich foods uh quatin rich foods and probiotics so yeah this is the system and this is the entire flow now what we will do first of all we will get the data that we will be using to train uh an AI model now let me show you the data that how it looks like then we will start the coding part so yeah this is the data I just take uh a subset of my data the name of my data is training data I'll share all the data set the database data set in the below descript description all this code we are going to share with you now in this data we have a lot of columns totally we have 133 columns but for Simplicity I have taken couple of columns all the other columns all the 132 columns are input columns and the last column that is called Pro prognosis uh prognosis is nothing but the diseases actually is our Target column so here is it is a supervised learning problem now if it is a supervis learning problem then because we know that in supervised learning problem we have two types of problem regression problem and classification problem so what it is it is actually classification problem why because in prognosis in the last Target column we have multiple diseases I think 144 I'll show in Notebook all these things right but we have 41 diseases like fungal infection flow diabetes and a lot of a lot of other diseases so it is a multi classification problem normally you have heard uh if you are a beginner that in classification we have two problems like yes and no um uh real or fact zero and one but this is a multic classification problem so all the other 32 132 columns will be input input columns in the last Target column that is prognosis will be our output column now keep in mind that prognosis that the target column contain 41 diseases okay these are our Target column now all the others are actually all the other 132 Colum are input columns now in input columns we have actually the symptoms so actually in this data set we are using 130 two symptoms the First Column is itching Second Skin R third modern skin eruption continuous eing shivering chills all these are the symptoms but total we have 132 uh I couldn't show all because uh you'll not be able to understand things now what are these these values 01 what are these bind values so actually each column uh has a lot of Records these are patient records this 0 1 1 0 0 1 this is a single patient regard this is another single patient regard so each row represent a single patient regard now in each row we see that if there is a zero it mean that this patient has itching no no itching zero means off but if in the same Row in the same record if there is a one it mean that in this column the schem R is a symptom that he has so one mean that that patient will have that specific uh symptoms if there is a zero then it mean that this patient has no no that specific symptoms let me make it easy for you as I told that zero will be off one will be on now this is the first record this entire record represent 13 uh2 symptoms for single patient single row single patient has one 132 uh columns means 132 records each record has a value either one or zero if one it mean that that specific column is or the symptom is belongs to that patient now this is the patient let's say this is my record I am the patient of this record so it mean that I don't have itching symptoms but I have skin R so here it was a one oops uh just give me a second here I have one so one means on means skin R so it mean that I have skin R again there was a one so I have model skin eruption but all the other was off so I don't have this is another patient recard let's say this is Nan and Nan is a person or patient so it's mean that Nan has a itching so he has itching but he don't have skin R because it was off so I hope you get the idea of data set now let's start the real working of this entire project Implement so first of all what we have to do we have to load the data set and tools tools Library so first we need to import pandas SPD uh then let's load the data set so let me give it a name by DF so CS now let me show you that all my data set are within this data set folder okay and we are going to work on this training. CSV data okay training. CSV data I have explained okay now within data set I have a folder data set and within that I have a uh CSV file actually the data that is trending CSV so this is my data okay now let me add couple of cells let me show you the data so by saying this now this is the data okay now in this data as I have already explained there are a lot of columns each column represent a symptom modin eruptions ex symptoms and we have their output column prognosis her record this is entire record disease disease fungal infection with symptoms the same disease and we have other disease as well so actually this is multiclass classification problem okay uh let me show you the shape of the [Music] data DF do shap oops actually it should be like this so we have 4,920 records with 133 columns [Music] symptoms disease if I go to DF prognosis unique value Niel then these are the L just l account like this so total we have unique total different but total we have unique 41 diseases okay so just name like then you would see we have this diseases okay okay fungal infection allergy C chronic chasis drug reaction repic Ulcer Disease ads diabetes all these okay now the data is already pre-processed as already mentioned the data is already pre-processed we don't have any missing value we don't need to do some other things we have to do only one thing in coding for this prognosis because isal is num because machine works on numbers not on string values okay so all the other columns all these symptoms are input columns and this is our Target y column okay so let's perform TR as PL uh let me add couple of cells okay now in TR test first we need to import from SK learn Library we need to import model selection uh let me tab so that it could suggest but it's not suggesting I don't know why uh okay suggest selection import trendit uh now trenit is used to help you uh divide or uh in split your data into multiple uh variables or sets you want okay we will see that a bit later uh but let me import from SK like this from SK L uh pre-processing because as I already mentioned that we have to encode the output column prognosis so for that we will be using using label incoder so we will see that a bit later but these are the Imports okay now first we need to divide our data into uh X and Y so all the input columns will go into X that was 132 except the last one and the last one column the output or the target column will go into y so what I can do I can simply say that my DF do drop uh actually let me give a proper name to my data set it would be perfect effect okay like this for it's just for better representation data set uh yeah like this data set shape and this should be also data set like this okay now here what I'll do I'll simply drop I'll simply drw from my data set uh the last one column that is prognosis prognosis actually represent the diseases prognosis now here you have to mention the X's you want you want to drop it on rowwise or column wise colum wise delete if you want to drop rowwise then you have to give it here zero but I want column wise so we'll have to give [Music] one accept this one because drop and the output column that is uh prognosis will be go into y right okay let me show you this is the X now here if I go to last part now here we don't have any last column because drop so this these are the all input column that has been stored into X and in y you will see only the output column right let's do Trend test plate so in my Trend function I'll simply pass X and Y with the test size now test size I'll mention a bit later but let me pass random State like 20 so but first let me Define couple of variable x x test y TR and Y test like this so so what will happen this Trend t split will split this data set into four set XTR X test white Trend y test what it will do this TR split function will take all the input values all the input variables values that was 400 4,900 I think so Char as no 70% data test size is 0.3 means entire data 100% so it will take from 100% data 70% data into ex but keep in mind from X not from y so X say 80 70% data X and the remaining 30% data total it was 100 we split test size we keep test size 30 so test size will be 30 it was just for X now it will do the same for y from output variable variable prognosis it will take 70% data into y Trend and remaining 30 into y test so what we will do we will train couple of models from XTR that is 70% data from input columns and 70% data from prognosis that is output column and the remaining 30 from input column and 30 from output column we will test our model so to see our model result okay so if I show the ship uh this is extr do ship and this is X test you will see total if I uh keep all this so it will become uh actually we have sh what was the ship 4,920 yeah so 3,4 44 x input column and, 1400 xest same goes with and Y test perfect amazing not understand this thing so let's upd that so this is my level encoder and level encoder say fit and encoder just [Music] transform let me show you and the same thing goes for all the other infection so actually what we have done just we encoded the string to integer perfect okay great now let's train top models so let's do [Music] thats Imports in so from SK Lear import me a classification actually it's uh optional let's go up from sk. data set data set import MEC uh classification it should be classification yeah and from SK learn do model selection uh uh actually uh support Vector machine Ali that is support Vector classif from leble model model random random forest classifier or gradient boosting classifier gradient boosting classifier not regressor okay so support Vector classifier model random classifier and gradient boosting classifier okay let's import NE say can NE classify so from escalan do neor class K Nest NE K NE [Music] classifier espcially use multi it should be multi multi different clus confusion perfect amazing create a dictionary to store models linear support vector class machines algorithm or nonlinear just one minute linear random Forest so for random Forest forif ROM for number of estimat so actually support [Music] Vector on the basis of nearest point from both classes okay gradi uh boosting or gradi boosting contrl C control V okay beginners confuse so this will beb spelling IG H right so neighbors neighbors and finally we have M multi NB so multi multi noal buing classifier can s classifier and we have multin noal na base now I am training five different models at the same time so python Loop so for this Loop will take two things model name actually this one this is this is this is this is this is okay and its value y model y this one this one this one this one this one this one so actually this Loop is going to take at at a same at first iteration will take the name of the model and the model okay but key sorry key and Value First iteration of the loop second iteration of the loop key and value let's print it model name [Music] gamec random forest with random Forest value gr and boosting so just okay so on first iteration what I can do oops like this so on first iteration I'll simply say Trend model so [Music] modela of our input column that is TR and 70% data of our output column that is white Trend oops okay Trend about Let's test the model test model so it will be prediction model. predict oops predict on X test to model modeling prediction let's calculate accuracy [Music] culate we are going to compare model comp predictions and the data that hasn't seen yet by any model perfect let's do confusion Matrix calculate confusion Matrix calculate C let confusion Matrix again will be equal by so first what we have to do let's print form so first let's print model name OKAY model name model name uh correspondingly let's print its accuracy with this message accuracy do the same for uh confusion Matrix so print format or model name oops I think model name with confusion [Music] matx matx to string Fus separator separator separator we are ready we are ready now this Loop First Take support Vector classifier so model support Vector classifier will Trend will predict will take accuracy we take confusion Matrix after that here will be svm so SVC C and here will be uh uh SVC accuracy the same thing goes here will be the name of SVC and it's matrices uh CM confusion Matrix is Loop will iterate second time for the second model it was I think random forest or what what was it it was random Forest so for random Forest it will do the same then on on third iteration it will be for gradient boosting let me check recording perfect uh so let's run it let's let's let's let's run it let me check numai Library yeah I have imported okay perfect so let me run it okay okay perfect perfect it's taking no time because our data is very clean and pre-processed so SVC give 100% accuracy on test data okay amazingly because data is really pre-processed that's why or this is actually SVC accuracy score is this okay this is the SVC confusion matx now confusion matx diagonal nothing no error this is okay this part this ma or mathematics okay same goes with down are [Music] Str with separation okay now secondly we have random for the same result perfect we have so all model will give 100% because the data is really preprocessed so perfect let me remove couple of Sales single prediction Now understand this thing it's very important but first let me I am going to select support Vector classifier so we I'm sorry for that kernel will be linear and uh SVC do fit again separ like like this SVC do predict on with uh with what wh test and or so again it will be 100 let's let's let's let's Let's uh save the model OKAY model from DP okay not dump SVC actually SVC so while saving what you do for B mode W right bind while loading the model you use RB read bind we will see in py Cham in production level okay so pickle SVC model with this name but I want to save it in this folder uh actually let me go and this models I want to save my model in this folder okay I already save it but I want you to save it right here that structure so the moment let me first models like this the moment I run this cell the moment I run this C let me comment it out it will save the model right here in models folder okay svcp but I have already saved so I'm not going to save it again perfect now let's load the model it was it was saving model let's load the model to use it load model SVC will be equal to Pi Library keep in mind load not loads load function not loads open SV C okay now it's in Model Model S enter Tab and after that read binary mode Let's perform some single uh recommend condition so my data set uh my data set let's take some X test value this is my X test okay now this is a record this is an entire record each record represent symptoms and as I already mentioned if eaching here is one it mean it's on I will take all these input for this 437 record uh for I will take I'm sorry so that's why I lock uh actually values so this is an entire input input where one represent symptom is located byy other zero represent symptom is not located s see I'm sorry uh not this one support Vector classif very important white test this number represent some dis fungal disase so the same if there is a disease with this integer 40 Value meaning model is working quite good but what I'll do I'll print this entire thing for better representation print model predicted disease like this uh like this and print actual label actually predicted and I also want to check the actual label yeah test one let's try another one so control V this is Test 2 now this time I'm going to take other card let's say in X test 10 1032 also I am going to compare it on the same 10 so predicted label perf now the main thing the most important part of this entire project is going to start first let me load couple of data set confusion so let me load it first I am going to load symptoms uh description data set okay symptoms pd. read CSV uh data set folder uh DF perfect so let me show this is the data okay now is my column had disease that represent all the disease that were presented in the prognosis okay or in model skin eruption uh these things okay so this data is not important but the second data that I am importing is very important that is precautions pre portions pd. read uh read CV data set oops data so this is the precaution dat disease drug reaction now keep in mind these diseases are similar to the uh original data output column prognosis these are actually these diseases very important part data disease colum we have put all the same diseases now after after research disease precaution one reaction stop irritation as a precaution when doctor says if doctor detect that you have a drug reaction it mean that doctor will going to uh give you some precautions that you you need to stop irritation also consult nearest hospital he can also consult you nearest hospital okay if the doctor is not expert in that field also you can say that stop taking drug some suggestion these are actually precautions not medication we will after that follow of some other and if the the patient has malaria after detecting then the doctor will say that cons n Hospital avoid oily food avoid nonv food something something something let's import some other data uh like workout doctor will not recommend workout but our system is more expert than uh doctor so it will uh give exactly workout so I have a workout data set like this uh now workout I am showing you each data set separately because it's very important when we will implement or a ler of code here you have you need to understand all these data set very carefully so again disease these are all the similar disease name and workout so fungal infection okay AG disease have fungal infection then our system will recommend in workout avoid sugary Foods uh fungal infection May consume Pro probiotics or whatever it is fungal infection may increase intake of garlic okay in only in case of if our model predicted fungal infection but let's say modict this impo or whatever it is consult a healthcare professional follow medical recommendation avoid scratching top five we will see that a bit later but I am just explaining so that you can understand things that what we have structured uh and description description will Beal to pd. read CSV data set uh and data set uh description okay so let me show the description part now in description again we have all the diseases and each disease had has had a description okay fungal infection called description that what is fungal infection how it looks like a lot of description likeor okay for each disease and we have finally medication the most important data set medications Wala pd. read CSV data set under medication now medication is very important so medication me disease let's say our model predicted fungal infection so we have medication these are medication name a lot of name here you'll see so for each if our model say fungal infection then we will recommend this medication okay by actually we are dealing database system let's do final part DS yes and this is our dietes okay fungal infection here then we will see that you have to do this diet this diet garlic diet allergy then we will say eliminate net diet omega3 rich foods so these are dietes perfect so actually these are data bases okay these are pre built or pre-defined data bases but keep in mind these are not some to datar research precaution workout description medication research so all things are structured and on the basis or research all all things are real not just dummy data set now let's create original thing or now let me create a function model uh prediction function So Def get predicted value patient symptoms simps symptoms so this function will take patient symptoms at a time it could be two at a time it could be be five at a time it could be three at at a time it could be 10 so this function will take any patient symptoms okay let me uh take few things so that you can easily understand okay so let me check the recording okay now Sy dictionary contain column values okay eaching eaching is zero with one this from will [Music] become disease list output colum actually prognosis where fungal infection 15 fungal infection fourer explore FAL iner this disease 16 and chronic colestasis 9 drug reaction is 14 so when our model when our model predict any disease it will not be allergy it will be actually Four okay or if our model predict drug reaction it will not be string drug reaction it will be 14 so so what I'll do firstly if our model predict 15 that I will take from this disease list fungal infection not 15 because user will not understand and user on my website will not understand 15 what is 15 he will understand fungal infection okay but for this first I need to create exob this 132 list because my model is trended let me show you okay this is the function now uh just give me a second now within within this function first I'll get this patient symptoms okay so here what I can do I'll create an empty array of zeros okay so NP do Zer or is symptoms dict so I am going to create an with Zer everywhere zp NP do Zer so it will contain so shap with all everywhere is zero just give me a second you will understand all things so let me call it input vector vector item in patient symptoms get predicted that's why predict value function this three values is nothing but a list of three values it will be with patient symptoms okay so I have to take one by one value first time it will take skin race that's why I am running a loop from patient symptoms from this take first time item skin Rich second shivering sleep okay why why we are doing that so that I can pass all this value within this empty input Vector okay perfect input Vector symptoms uh dictionary okay symptoms dictionary and symptom dictionary item one what is going on what is going on going on is this thing recorded this is my one record okay this is my One symptom record exob sympt first I created exob empty zeros everywhere these exob symptoms or columns or values represent this disease fungal infection okay so what I'm going first within that function I have created input Vector that contain X 132 empty zeros okay after that I am going to put if user put uh if user let's say user input is um user input is skin R okay user input is skin R and model skin R so I am going to within that all 132 empty uh empty list not empty list actually contains with all zeros 32 zeros put there one skin if if if the user input is skin R then put one if the user input is model skin eruption then put one if the user input is is each input one let's see user input is shivering then there is zero in our original data there is zero then no don't need to put Z so let me explain it right here but we have input Vector 132 so I am passing these three values within one one within input Vector that is 132 put put item but before putting item Tech symptoms dictionary aging skin R [Music] one1 that's why I'm giving this part I hope both complicated return support Vector [Music] uh uh actually predict on input Vector right it should be support Vector classifier oops support Vector classifier so support Vector classifier predict input vector chronic this but I want actually if model predict 9 I don't need N I need this thing if model predict of 15 then I need this thing so I'll pass simply this entire thing within the uh uh disease whilea list like this perfect now let's do proper things so what I can do test one okay execution us inut enter your oops [Music] symtoms uh symptoms Hing sleeping coughing if I enter Then This variable these values will be stored in symptoms actually we are going to take this thing separated so what I can do yeah is symptom say at a time first time it will take itching second time it will take sleeping then chopping but function comma so if I run it oops it will give error because it will return s s dot this s dot strip so up now you will see the same thing but symptoms user symptoms X let me check the recording okay mostly for simp in user symptoms system symptoms let's enter itching coughing coughing or cing let's say sleeping [Music] enter coughing sleeping [Music] strip uh list list with the last thing I'm talking about this last eaching sleeping up [Music] CCC so uh it's actually the [Music] same like this a BBB CC I'm sorry for the backround [Applause] user symptom again update symtoms first I'm taking from user uh some symptoms then I'm stripping splitting and also I'm going to list with this space and finally I have this thing user symptoms user symp [Music] a a b b c okay get to predicted value I'm calling this function and I'm passing these user symptoms to this patient symptoms so user just give me a second let me check the record just give me a second user symptoms predicted predicted d disease let's trying skin or shivering hand skin R and shivering so fin disease fungal infection let's try some morees like let me so [Music] let's symptoms but yeah no skin eruption Orr see this is CHS okay and uh I have uh uh let's say sleeping let me add couple of more [Music] like let me check couple of symtoms random I'm taking random uh s DT star ma pen enter and there is an [Music] error like this symptoms woman no skin eruptions spelling mistake [Music] error like this oops and like this joint pen joint [Music] pening chills and shivering Syms joint pain represent stomach pain B stomach pain acidity CHS and shivering these are the symptoms that actually represent alergy so perfect we are doing to we are going to create the actual system okay so uh what I can do now the actual system will be very simple AB I have some databases okay so I have this five disease okay this one this disease destion this is my data so I'll use filtering method in pandas I have a complete playlist of pandas if you have learned that playlist then you must know what is filtering predicted disase and this description is this so what I've done by one fungal allergy good and check equal to allergy my predicted disease then take the corresponding description so let's see dise equal toer so allergy is an immune system reaction to to so thisp so this is our destion description second thing second thing we will take precaution so I have this data set precaution disease corresponding precaution precautions [Music] description you can clearly see like this like this [Music] okay list comprehension actually I'm going to use uh uh instead of this thing I'm going to use a loop W for w in uh description or description now let's talk about the other it's actually PR equal equal to my disease model disease that is predicted predicted predicted [Music] disease precaution underscore 1 pre now I'm going to take this one precaution 2 just let's see okay let's also take other precaution three and finally pre caution for mistake spelling mistake spelling mistake I think precaution two precaution three precaution yeah there is a spelling mistake okay that's let me check now precaution one precaution 2 precaution 3 precaution 4 or [Music] umatter [Music] soe predicted disease let me check precaution precaution again spelling mistake it should be a should be before so like this like this again list comprehension colum for call in uh precau let me call it helper function helper function So Def helper dise please this is very important so just we performed it will take diets workouts description for that specific uh disease let me let me show you okay just see now so what I have done I have already uh that function so just copy now de helper it will take a disease after that we are doing the same thing so first we are going into description description disease if if the disease that located within the description if it is equal to R disease R disease is this one then take the description and this is the description okay the same thing again precaution precaution disease if it is equal to R disease then take all the precaution for that corresponding disease and store it within this okay this is the same part again go medication medication if equal to disease then take the medication part and take the values of the medication and this is the medication and same for workout same for sorry same for diet and workout and this function will return description this one precaution medication and diet okay now what we have to do we have to when we We call we are going to call this function this function we are getting only predicted disease this is true right we are going only the model predicted disease so after predicting disease what we can do uh we can simply just let me copy this part I'll explain everything from scratch let me set up things we are right here okay we are right here so I am going to call helper function and within helper I'll pass predicted disease okay so I am going to first I have taken input from user then the same splitting stripping after that I call get predicted value user input this final input it will be right here within this from that we are taking disease name if model predicted 16 then we will get good and that good will be within this okay predicted disease and after that I'm calling helper function and sending that disease okay so helper function helper function this this is the helper function it will take uh the disease predicted disease and after that it will give for that specific disease all these things and I will get all these things right here so I have taken all these things right here so if I run this thing and this thing maybe let me compare all the data set this data set is not important remove it so we have precaution so let me copy precaution maybe because I just copy paste so spelling mistake precaution after the description description okay workout uh before workout medications so I have medication spelling right diets but where is the workout okay workout is there dates and workouts I have so dietes work out everything are okay everything are perfect okay now uh give me couple of input like I'm going randomly okay itching coughing sleeping it will be fungal symptoms uh there is an error eing okay again you don't need to do spelling mistake uh eing sleeping coughing spelling mistake is very important again I think I did a spelling mistake sleeping we will handle that okay we will handle that later but um Let me give couple of symptoms like itching skin r of this again what is going on name description is not defined the error is in the top function it says that name description is okay it should be this cryption now hopefully description description itching uh coughing again error so let's see where I made error coughing again we don't have coughing okay itching skish so we get result so let's see what we get actually so we have uh predicted disease this is a predicted disease and after that I am going to prate this thing disk pre m die workout all these things uh description this is the description fungal infection fungal infection is a common skin condition caused by fungi and after that I'm going to print uh precaution so these are the precaution bch twice use D or name in boting water I'll fix that I'll fix that a bit later so let's one let's fix one by one okay so before printing let's make it beautiful or or what we can do we can do it right here results printing okay I'll explain everything okay so print now within this print I'll write predicted disease print this is a predicted disas after that I want description like this and print dis and description of after that uh it should be like this [Music] precautions like this and print print so oops again I have to type itching uh skin R so yeah you can clearly see this is the disease predicted disease and this is the description and this is the uh precautions now here in precaution you can clearly see it's not perfect so I'll run a loop I'll run a loop here here right here so uh just let me show you here for uh precaution I in precaution at zero then print Pi h SK now there both twice dis actually it predicted disase it will should be right here not there I'm sorry for that uh and this should be description and there should be listing for so itching sken R now perfect but I want also count one bwise two this line three this line for that uh uh it's very simple I have a variable let me Define a variable by zero or you can call it count and after that I'll print I here and let's give a space like this and after that I'll uh increment I so let's see Hing skin now perfect zero and okay it should be one actually okay let's do the same for uh this should be precautions after precaution we have uh medication so let's do the same for medication uh let me copy this part crl C control V uh this should be medications and there should be M and there should be Mi M I like this so itching skin R so yeah we are getting predicted disease that is in fungal infection we are getting description fungal infection is a common skin and we are getting its precaution bath twice use dour or NE in bothing water keep infected area dry use clean cloths okay what is going on with this part actually I kind can't use here uh this thing I think because it's a list of list array uh [Music] asking okay now it's a list single list but still it's not perfect we will see that later let's do the same for uh workout so again let me print this partr C copy this part and just pass control V and here I can say workout uh here we have workout okay what was that workout wi teing sken R now let me check workout so these are the workout work out aoid sugary Foods consume Pro probiotics or what increase intake of garlic include yogurt IND di limit process foods stay hydrated different different result you'll get different result by giving different symptoms but for time being I'm just uh using the same so finally we have died I think uh let me check finally we have workout we have die this is actually D so let's do that for d uh I'll explain the above all code okay D die not die it should be died but yeah uh let me type die yeah so eing skin or let's type some other this time let's type some others uh let me take some from last I have this symptoms this four or five symptoms let me copy this contrl C and uh uh like this so I have uh I have spotting urino and I have Burning uh mation I don't know what actually it is biology names are really complicated to honestly speaking so I have vomiting vomiting vomiting burning jelna duration spotting urination something like I don't know but let's try it out so I run it and there is an error because the error was this T and input so let me because I forgot I think by removing we will handle this error because this is very important in website when we create when we will be creating website so now predicted disease is drug reaction definitely if you are vomiting uh if you are vomiting if you are burning if you have Sports Ur intio it mean that you are taking drug reaction um you have a disease or you are in infection of drug reaction and the description of drug reaction is drug reaction occurs when the body reacts adversely to a medication perfect perfect really perfect stop irritation these are the precautions consult n Hospital stop taking drug follow up okay and these are the medication these are now this medication are exactly for drug reaction you have to take anti Hines or whatever it is epinephrine cids you know biology names are very difficult antibiotics antifungal cream so these are the medication we have also workout okay discontin offending medications stay hydrated include anti-inflammatory foods consume anti Oates avoid trigger foods include omega3 flatty oet limit and finally we have Diet now these are the diets okay anest manic diet omega-3 rich foods vitamin C rich foods uh Curtin rich foods probiotics probiotics okay so amazing it's working perfect and uh let me explain all these things again so what we have done in this simple notebook firstly we have this Imports dataimport then we have checked some pressing like simple people SE that we have TR test plate uh and we have TR top five models and we got amazing result for each one but we selected support Vector classifier then we save support Vector classifier then we imported the save model now this is the production code okay first we check for single input and then we create a complete recommendation system so here what we are going uh here just let me here what we are going first I imported all my research based database precautions workout description medication DS uh then I've created a function by the name of get predicted values but I needed 132 shapes so I created 132 uh list or array with empty zeros and after that I get patient symptoms it could be three it could be four it could be five then I take that one by one and pass it to my input Vector with symptoms dictionary because in symptom dictionary I have exactly the same symptoms and give it a name if it is located within that list then give it one because one represent that that symptom symptoms is ex existed or located in that list after that I return I predicted for my SVC model the input Vector entire list he uh return uh the disease but it will either if if the disease is if the model predicted disease is fungal infection then it will be 15 so I don't want 15 I want fungal infection that's why I pause this entire prediction system into disease list disease list okay and after the I take input from user then splitting stripping then I call that get predicted user symptom it will be right here after all these things it will be give a single disease like if it is fungal infection that it will be fungal infection now I want recommendation so that's why I pass this predictor disease to helper function predictor disease and my helper function is right here and helper function take this disease and taking from disease the description for that corresponding disease and storing here then taking four precaution for that predicted disease and there and taking medication from that for that corresponding disease and there storing something goes with dots and work out and return these four or five things and I'm getting this four or five things right here where where right here I'm taking this getting there after that I'm just predicting the modor predicted result and description that I get here from helper function precaution medication diet and workout a simple simple as that now one thing import cyle learn escalar very important part mostly student ask me that I have this error I have this error so import escal after that print escalar doore version under underscore now we have trained our model on 1.3.2 CY lar if in your case it is 1.10.0 or 10.14 or whatever version it is you have to use exact that version in p so now I will open p where we will install exactly this version in your case if you have 10.14.1 then you have to install I'll show so let's do that so Pam open now in Pam you need to create couple of folders because because it's very important so I have this folder medicine recommendation system within medicine recommendation system first you need to create virtual inv environment now I hope uh you must have idea that how to create virtual environment in pyam okay after that you need to create just right click on this folder go to new and go to directory and there create a folder by the name of data sets now within data set put all the data set that I have shared in the below link first the training data after that all the other data set like description. CSV d. CSV medication. CSV precaution symptoms and workout okay just put all in data set folder after that create another folder by the name of models in which save the C support Vector classifier PK file that we have saved okay actually the file and create another folder by the name of static and in which put this image I have shared this image with you just put this image in the static folder okay this is the logo for our website now what I I'll do I'll go to Medicine recommendation right click go to new and go to python file and I'll I'll create here main.py file okay this is the file in which we will do all the backend code we will be using flask framework for backend okay now first of all you need to go to your terminal and install all the packages that we need for our development so here first type peep install flask f l a flask and enter the moment you will enter it will be installed because I have already installed so I'll uh ignore this part after that type again P install cyut Larn here you have to type S uh cyut D learn learn equal equal uh to the specific version that I have shown in the notebook I think it was 1.3.2 or something or whatever in your case whatever it is just install that one in the same way and uh uh also install numpy and pandas numpy and you need to install pandas once you install all these packages because I have already installed so I'll not I'm not going to do it again but you have to do it after that just import uh from flask import there is a clask uh with capital a flask and request I'll show and I'll explain all these functions of flask uh framework and render template so for now just import flask request render template from flask okay after that create uh here floss app we create app uh with this object capital F actually this F within this you have to pass a builtin command by the uh under uncore name now this app is created actually this is the object of floss we have created object of floss class now I can play with this app so what I can do I'll create here python Main in Python main how we create python main we say that if name equal equal to name equal equal to oops uh name equal equal to _ men uh then just give me a second and uh uh let me check the recording yeah and within this call this app so what you have to you have to just call this app and then run and debugger will be true I'll explain I'll explain all these things so currently you have to create all these things don't need to understand but type all these things okay exactly the same now I am going to create another directory so right click go to new and click on directory by the name of templates now in Python flask Frameworks as I said that we are going to create a website so we are dealing with web development so for web development we need HTML files so flask gives you this folder templates keep in mind exact spelling T MP a lot of student types comment and says that templates not found error actually you have typed a wrong uh uh misspelled template this is a buil-in you can see that this is a built-in folder for flask so exactly uh this uh uh spelling templates now on template right click go to new and go to HTML so the first I am going to create here index.html uh after that uh I will create another go to HTML and I'll create contact contact. HTML and I'll create another HTML file uh by the name of uh uh uh like uh we have about HTML uh and we have developer also so I'll create another page uh developer uh like this uh uh uh developer. HTML and I also need to create uh another one I have about contact developer index and the last one will be blog. HTML now I going to uh open go to your uh Chrome browser and open bootstrap now in web development for front end uh working will be using bootstrap uh actually bootstrap uh is a online tool that will make your work easy especially web development part front end part so just copy this thing okay uh startup template it it is called startup template and go to index and I'll copy it in index I'll copy it in contact select all and past also do the same in about part and developer part right and also do it in blog HTML let me close the other one uh like this and let me also check the recording because sometimes it's stopped uh internally maybe there is an issue but I don't know why so this is hello word in hello word I'll say simply a health care center okay and I will add here a class this is actually a bootst strip class uh text Center for now if I open it the text centers mean that I am going to let me show you this Healthcare I want in Center not here so first what we will do we will work on this Nave bar this is actually Nave bar okay in this Nave bar first we will put logo then we will type this Health Center then we will create names home Naes about contact names developer names blog names okay so first we are going to work on this for that I'll go to boot strip and within bootstrap if I go if I scroll down in components keep in mind in components you'll see a Nave bar click on this Nave bar okay and within Nave bar uh just copy this one okay this na bar okay this na bar copy this one and I'll go to my index and before H1 within body I'll uh add a comment this is Nave bar control for/ so that it could be commented out and after that I'll paste these things now you will see a lot of things but we will make it easy I'll remove couple of things okay let me run this so that we can see what is going on for now I am not going to run this uh app from flask I'll run it directly from here so click on this chrome option in your pyam and this is my bootstrap demo uh currently I have this white color na bar and this health care center so I'll change these things and I'll also change the color of my Nave bar so let's see uh if I go to the top of my Nave bar my Nave bar actually starts from here honestly speaking let me check record again perfect so this is the na bar that is start from here this is the built-in class that is coming from board step so I'll just change here this part okay now here I'll say that Nave bar dark and space I'm going I'm using some uh bootst step classes and BG will be dark so if I go to my na bar as you can see now it's dark after that there you will see within a there is a class don't need to change this but change this na bar to what was the name of my website let me check Health Center give it a name by [Music] Health Center okay and yeah so after that this is home okay and here I will in HF I will use index meaning that if someone click on home link on this home link I will be within in this index okay this is the meaning of this and I will remove all these things from here I don't need it like this one I remove this and uh instead of link I'll say that let me check we have about contact developer blog okay about contact so I'll say this is about also you need to give it here forward slab and I will copy this control Ctrl V and there instead of about I'll say contact and also there will be contact again past to control V and I'll change just uh I think this this should be developer and developer and again past the same thing and from about this time it should be I think [Music] blog blog so let me check uh if I go to my one now we have home about contact developer block perfect so now here I'll put an image now as I told you that you must have in your entire directory you must have a folder by the name of static and within static put that image that I have shared with you just do that nothing else so we have this neigh okay you don't need to focus on the development part that how I to remember all these classes you don't need that okay with the passage of time you will remember all these things but for now just follow and uh yeah just follow so uh now what I can do uh right after this button okay or I think I want to add image so the image will be after this or before this yeah before this Health Center Health Center I will add here my div this this is my div okay uh and I will give my class by the name of logo because I will use also custom CSS and within this I'll use image tag and within image source uh in source as you as I told you that I am using uh an image from static directory so in flask if you want to display image on front end then you have to use ginger template uh snx so this is ginger template SX and here you have to pass URL and uh within URL for and after that you have to use open and close uh small brackets and within that you have to type single code open single code close and within that you have to write static static meaning this directory and go outside the single code and uh press comma and after that write file name equal to what is the name of your file that is image.png this is the synx and you don't need to remember the syntax what you have to do in the image tag within Source type uh two open curly braces two close curly braces after that type URL 4 and type open and close small bracket and within the small brackets type static file name and image.png because uh in static if I say my image is image. PNG perfect now let's see what is going on currently it will if I roll it will it will not be displaying because I have opened it directly from here but if I open this from flask then you'll see the image so let's do that so what I can do but uh uh just let me check the recording before going to uh main. Pi flask while part let me add here a custom class that I'll be using in custom CSS uh so let me give it a name by my image okay so keep in mind in N we have this part on this part we will do our custom CSS other things are perfect now I'll go to m.p now in after AP I will create Roots uh Roots so what is root how to create root you have to type at the rate after that app actually this app do root and here you have to give the path So currently I want the moment I open AP I want to open uh index. HTML so I'll keep it empty after that you can create a function let me create by the name of index now it's it's it's not necessary to give it exactly the name of the page that you want to go as I want to go to index.html the moment I open the app so here you can change the name doesn't matter now in index I'll say return render template and with the render template you have to give index. HTML render template is used to help you in navigation as we are dealing uh with web web app and we have a front end and in front in front end we have Naes uh Na bars or you can see we have links so in flask if you want that when someone click on home and if you want to go to home then here you have to uh in in in home we have index so if you want to go to index then here from back end you have to create root after that you have to create a function and you have to return that that part and for returning that part you have to click render template this render template will redirect you to the index page that's the flow that's the flow now I will right click I am going to right click within the main. PI right click and run man run man now here you will see a link just click on this this is a URL actually now here we have something template and tax error unexpected charart so there is an pattern uh let's see uh render index.html uh just let me check I think I have met some okay the error is in this part let's see just let me check then I'll show so I have used Source URL for uh static file name I think it's it's right but why uh Source URL for static to see the recording yeah give me a second m let me check the templates name yeah it's perfect and here we have a root so the error is here if I comment out this part this is the ginger template and if I go to here and reload it uh we have in render template index.html error uh let me check the index if I go to template within template I have index.html and yeah it's I don't know where is I made a mistake but let's see uh clearly unexpected char okay this character okay okay okay let's see the issue is uh even though I commented it but it didn't reload it I think okay I forgot as you can see here this single code after that image.png you have also you have to type here this thing okay so this syntax is very necessary keep in mind you don't need to miss anything a single thing if you miss a single thing that you will definitely get a letter so if I reload let's see if it's working or not okay so we got it but it's quite big it's quite Big Image let's work on the na bar so as I have this div logo and my image so what I can do I'll use uh a custom CSS okay I'll use a custom CSS so that it could make things perfect for me so for custom CSS either you create a separate file or you can directly use inline CS s so what I can do before body I'll use style tag for CSS we use style tag and here I'll call the logo class of my div and within that I'll use some properties like I'll make the width of the T 50 pixel and height can be also 50 pixel and I can also give it a color like BL like I'm just working on the D not the image okay and margin top will be zero and margin left will be two I'll show all these things margin left will be two yeah like this I will also work on the other class that was my image uh in my image I I'll do the same things because my image is within this div this is the div actually I'll show so let me copy this things crl C and crl V and here I'll remove the color because image don't need color and butth I'll also remove these two things because I have already done in the div but I can let me show you let me show you first then we will do something else so actually I worked on this logo I mean and this entire div after that I worked on this uh image so if I go to now reload it now the image becomes very small quite good but I wanted goal Circle goal Circle okay within my image you have to use border radius or first you need to use border let's create border I want a border with two pixel solid and let's give it a color let's black border and Border radius will help you in ghoul in circle if you want to create something circle like then you can use n CSS border radius so uh 25 pixel Let's see we will change if let me reload now it's good so yeah this is our uh Na bar so Nave bar is ready but I'll also create roots for for this currently I am in home this is is actually index if I click on this uh okay I didn't create yet if I click on about it will give you no found URL because I didn't create root for it uh also for contact developer and blog so I'll go to men and I'll copy this Parts crl c crl v right and here I'll give it if I also open index and within index if I go to to my na bar uh first I have index then I I have about so let me give it about now here you have to give specifically the root name about and function name should be about and also I want to go to about so now if I go and reload it I will click on about hello word because in about I have also let me open about about about in about I have Hello word let me WR write here this is about let me also change the title uh about uh this is about reload this is about you can go back okay now the moment I click on contact developer block do the same so very simple just copy paste copy this thing contrl c crl vrl vrol v so that was about about we have contact I also change the function to contact and I also want to go to contact page meaning this one contact uh we have also blog so blog blog and blog and finally we have developer so devop developer uh I think yeah so let's see let me reload uh contact uh and about about didn't working I think the link this link uh has been destroyed so what I can do I'll run it again uh and there is okay okay okay that's because I have also to change about to developer because I have already about function so you don't need to duplicate the function name because I already have about it doesn't mean that if the if if you have there a root is developer there must be developer but this thing can be changed a b c it doesn't matter but the error was because I have already a function by the name of about so that's why uh it says uh the error said that you orite a function okay view function these are actually view functions so I'll give it a name I want to keep things structur and easy for me that's why I'm giving same names these two things must be similar with this okay and also here in uh index in index the names these things must be similar as you can see here we have blog developer contact about and here we these things are similar and and if I go to view function we have similar but one thing one thing keep in mind this contact and this contact uh actually it will give an error because uh there should be smallest small C uh D must be small B must be small so these names this file names and these names and these names must be similar otherwise the function name could be Chang but now duplicated function let's say there you have about there should not be about so let me run it again now this time we'll see so let me click on the URL let me close the other page uh yeah so if I go to blog perfect it's working if I go to developer perfect it's working because I didn't change the name so if I open the other PES like blog contact develop So currently I'm in contact so let me go it contact contact and it should be developer developer about was I think done so index also done contact also done and we have to change for Block I just want to show things otherwise I'll change all these things later so I just want to show you that how it works so but first let me check the recording again because sometime it stops internally I don't know why but yeah it's happening with me [Applause] so let me reload and if I click to about I am in about if I click in contact I am in contact if I go to developer I'll be in developer if I go to blog I'll be in blog section so now what we will do uh we will create this form okay we will work on this form right after Healthcare Center and we will also work to create this things okay so for that let's go to pyam let me minimize it uh close all other if you want uh let me close but keep just index. HTML now in index write after Nave bar now where is the Nave bar this is the Nave bar right after na bar and after this title I'll add a div a bootstrap d d do cont this is a a class and within this div uh I can add form and action will be predict I'll show that lat that why we and Method will be post for now just follow me we will see that later so let me um let me maximize so that you can see things and and also let's make it full view yeah now it's perfect okay so let's uh beautify this D but before beautifying this div I'll create another D within form uh with the class form group these are some built-in uh boot step classes and within this I'll create a label and for will be symptoms where I'll text symptoms but in this label I'll just give uh give it a message that select or type let's say type not select type symtoms symptoms I think it's good and after that I'll give it input uh with the class of form control like this uh instead of text yeah it should be text type should be text class will be form control and after that I'll add name simp uh simp temps this is very important in back end this will uh help a lot in men. p uh and uh let's add plus holder uh use symptoms symptoms like uh just for user uh uh just to say record here Hing like War Waring uh like uh coughing like this so if I go to uh my this one page and reload it now I have this form okay now this you here you can see use symptoms like each vomitive coughing this this is just for Simplicity for the user that's why I use plus holder this is the label and this is the input okay but I want to make the background black so I'll work on div because everything are placed within Canna right so uh first I'll give it margin top will be for this is the built-in class from boot strip and m y will be for and text within the entire uh but I don't want the text and after that I'll use uh here inline CSS so I'll add style back uh back round will be black color will be color will be white let me show you now it's black I also want to give some border radius and some padding so border radius B radius uh let's say B radius let's say 15 pixel and uh padding could be 40 pixel uh yeah I think it's perfect uh let me reload yeah now it's good it looks good good now here we will add a a button so for that what I can do first let me change the title uh here it's uh this title I'm talking about actually uh this title boots instead of uh bootstrap I'll say that Health Care Center like this so yeah okay so we were here now outside this div before the form I'll add B brick and after that I'll use button uh or yeah I should use button so I was thinking to do some more styling but I think it's enough it's uh perfect so this is the button and I'll use here A Class by the name of BTN BTN danger uh these are buil-in classes for button from boot strip so if I check now this small button so let's make it beautiful so here I will say that you can give it like uh your name like you can give it a name that predict or whatever it is so let's say give it uh recommendations it would be uh perfect now I'll also give some styling to this as well so I'll use inline CSS now first I'll make the width uh 100% because I want I want the button everywhere from here to here the whole width of the D that's why it will be 100 so next you can also give it padding padding let's say 14 pixel and margin bottom margin bottom let's say uh 3% or I don't know let's say 3 pixel would be or 5 pixel let's say 5 Piel so let's see the button if you want to work on this text you can also work on it let's say make it a bit bold text will be bold if I reload no no I think phone size it's text font or font size I uh honestly speaking I don't remember this property so let's remove it okay so our form is uh ready now the moment user or patient type here vomiting we will get sorry not vomiting symptoms we will get all the symptoms uh in man and if you want to get symptoms in man then you we have input where user will type all the symptoms and we will get all the symptoms by the name of with the help of this name symptoms so what I can do I'll just copy this right uh and then I'll go to men within men now I will create here after the index whilea root I will create another root AP ap. root and here I'll give predict because I in in in in form I have predict path action is predict so I here uh in rude I have to give the path predict and I'll create a function by the name of predict now this is the main function in which we will Implement all our predictive recommendation system W part I mean the code okay so in this predict predict function first what I can do first of all I'll get the all the inputs from the input so if request do method equal equal to post now you might be thinking what is this post and what is this request and what is this method so here in root you have to give comma methods keep in mind methods methods equal to square bracket post or get now in form we have method post now post and get are the method that are used for getting uh taking inputs meaning like getting input from front end and passing it to the back end or take it from back end passing it to the front end so for that we use mostly methods post and get for security purposes so we will work on in form we have post so here we must have form so if the method is post then you have to go forward okay and here we have to take all the symptoms from user not from user actually from the form so how to get it you have to type here request dot uh form values uh we have a lot of methods I'll show that but instead of form values I'll use here uh directly form and get and within uh here you have to give exactly this thing this syt now you might be thinking what is this symptoms this symptoms is actually this name I am asking front end that please give me whatever user type in this input with the help of this symptoms so with the help of symptoms I am using request that was imported from flask this requ let me import couple of things more like uh numpy as NP Also let's import pandas as PD because we are going to load the data set also import pixel because we are going to load the same model okay here I will load datab bases oops I'm sorry uh here I will load databases and here I will load model uh like this a bit later but first let's work right here so after getting symptoms I hope you get the idea that what this part is doing after getting symptoms what we can do we will do exactly the same like in Notebook in the last recommendation part so in models I have a notebook the same notebook I'm going to open it right here you can directly do it from there there but I can directly open it here so if I oops so I think this is the another notebook so what I can do I'll go to uh I'll go to the code that I have used actually this is the gup code that I have shared with you in the video uh the moment you click on the link you will get all the files right here okay so I have opened the notebook so that I just copy the last part uh actually I'm going to uh which part I was supposed to take I was supposed to take this part okay this part contrl C now I'll explain okay don't worry I'll explain I'll go to men. Pi and right after that I'll paste this code because I get I get symptoms from the front end now after that I'll remove this thing after that I'll do exactly the same where I have splitted the symptoms by comma and stripping and after that I have removed extra characters uh Again by using this trip uh from the user symptoms actually this one and finally I get that user symptom this is actually the final clean user input or the symptoms now I will pass this symptom to the get predicted value function so exactly exactly I'll copy exactly this function this part uh because I need both now I'm using exactly the same code I don't want to repeat it again again otherwise the video is will will get lengthy it's already lengthy so right here I'll add a comment custom yeah I think I have already so let me zoom out so that you can see things easily like this so here I will also load the data sets so let's go to copy that part as well I have already this data set uh let me check that if I saved the pickle uh yeah I have this one so let me load the data sets right here I'll P this thing uh all exactly the same part exactly the same now I'll also load the save support Vector model so let me check uh recording honestly speaking sometime it stops so I just want to see maybe it stop and yeah so I loaded the model using pickle and I also loaded all the databases and I have exactly the same two functions one was the helper that was uh give me all the recommendation from the databases exactly the same code and one is the get predicted value that is that that is predict the disease and after that I have this Roots let me make it easy for you I have all the roots and now within this function once I get this thing I have passed to users user uh get predicted value and from there what I'll get one first I'll get predicted disease and this predicted after that I pause this predicted disease to the helper function and helper function is going to return me few things like description of the disease uh precautions medication diet and workout okay now I'll simply pause this things to uh my front end how to do that uh very simple here I'll simply return render template and within Rand template uh I can go to index.html and after that I'll say that predicted disease will be predicted disease I'll explain what what I am doing I'll explain a bit later and this disease description will be equal to dis and D disease precaution will be equal to [Music] precautions uh and uh we have also medication so D medication will be equal to medication and uh finally we have disease workout work out will be equal to workout so actually if you want to display things on front end on front end you have to pause it with the help of variables so these are my variables so what I have done while moving to index.html uh I have pass predicted disease to this variable predicted disease description meaning this description actually I have pass to disease description the same thing goes for the other variable now I can simply use predicted disease uh D description D precaution medication and workout in front end with the help of Ginger template I'll show that letter but if I go if I go to this one here we have couple of buttons the moment we click on predict button we get this thing so let's work on this part uh in index. HTML but uh before proceeding uh what we can do uh let me show you uh this things that uh we are passing from here like uh once we get the predicted disease description precaution medication and workout how it looks like uh if I print them uh in index but uh one thing more uh you should do is all these data sets are coming from this folder okay uh this folder data sets so here before for the data name you must give it like data sets and forward slash this is important so let me copy and let me paste it before everyone like this right because I know that all my data sets are present in this data sets folder description DS all these okay and also though we have in models folder we have support vector classifier so while importing support Vector classifier you have to mention here model as folder okay like this now they will not throw an any error okay so currently we are ttings now let me run it again uh predicted disease this should be changed to D okay uh everything's are perfect yeah I will explain all these things a bit later but uh I will I will explain the flow actually from front end to back end and from back back end to front end but first let me run it again once so let me open it so currently we have these things okay and this is the previous one okay so here what I can do I am passing actually uh predicted disease D description D precaution so in index after the form uh I can print them and if you want to print something in HTML file in using python or flask or Jango then you can use ginger template so we have predicted disease okay this one not there let me actually I'm printing this thing uh this one you have to exactly this variable copy this variable and past it right here actually let me print it in a tag so that it looks a bit better so yeah uh if I past uh uh some let me try it out as you can see fungal infection it's printing here so if I print control d d d and after that I have these description then I have these precaution then I have these uh for now let's see there this three one so actually I just printed for now this variable this variable this variable so if again let me put some random uh symptoms so yeah I am getting B twice so what was the third one it's not printing actually the third one and the third one was this precaution so in this way you can print things but we will not print them like this what we can do the moment we click on this recommendation button like here like here the moment I click on this recommendation I want further five button here to be displayed like here the moment I clicked on prediction I pop up all these things so for that what we can do let me remove this part from here right after the form div just below the form D what you have to do uh I will first create H1 tag where I'll class I'll add a class by the name of text Center and myy it should be Center margin top will be four and margin y will be uh just give me a second four and this should be text Center and after that I will add a container boot strip div. container like this okay Tab and I'll also e uh I think actually here I will use uh another class of bootstrap a result container okay result container oh yeah this is my uh actually container in this I will create five buttons okay five buttons so button one with the class of toggle button this this is a class from uh uh coming from uh boot step I'll explain just follow for now okay and I will I will add another thing data uh base toggle data B toggle this is uh attribute in HTML and we will see why we are going to use it and within that I will pass uh a valume model and you will see that what is model a bit lat after that I'll add data uh BS Target and there I will give ID this is my ID uh I'll give it name disease uh let me give any name don't confuse yourself we will see all these things in detail so for now let's model it now in this button I'll see I'll write disease this is my button so if I reload my page you will see it you will see this is the disease uh button so let's make it beautiful oops let's make it beautiful uh so what I can do I'll use in line style in line cses so here what you can do you can give padding let me do all the style then we will see okay so this is the button uh we have a class toggle button we have data BS tole model we have data BS Target disease model this is the the ID that I'll be use a bit later after that I add my custom style padding will be 4 pixel margin will be 5 pixel 40 pixel uh in margin I have left right top bottom and phone size will be 20 so these are some styling you know and I'll type here dis so just go to my page and load it so now it's beautiful so I will create four more button for description precaution description uh sorry medication workout and diet so I'll do also that so let's see so I created all the buttons okay with the same classes same attributes just I had changed uh datab Bas Target the first button will contain disease model second description model precaution model medication model workout model and diets model now let me explain one by one but first let me cut this entire div and let me pass this with another div by the name of container because I want uh if I show if I show currently my button is here because I didn't use container I use result container So within this container bootstrap container class I'll use the bootstrap result container and also let me add re e i uh doc results now uh the Style part is same everywhere the Style part is same as we did for the first battern so why did why I use this uh uh datab BS tole datab BS Target you will understand this things a bit later but what we can see if I reload we can see these things now they are perfect but what I want actually I want to display this things when I click on the uh recommendation button so for that we can use logic logic in the sense uh if I cut all these things from here contr x and if I use here this kind of synx if predicted disease then uh in ginger template we end if like this and within this pest whatever I have cuted right like this so what I want I want that when I click on the predicted button then I will get the predicted disease so it mean that I don't want to see all these things before clicking on this button that's why I use if check now if I reload still I can see but because I I didn't uh if yeah now if I reload I can't see anything because I didn't click on this but if I click if let me uh add couple of syptoms now I can see so here I use actually Ginger template this is ginger template and I hope you must have any uh idea about Ginger template we we use ginger template when we want to implement python code in web development now now this is HTML file you can't use any programming language uh in HTML file but python is the best so we can do by using this kind of synx okay now uh now what I want to so here I want that if I click on disease button I want to display here a window box in uh if you have used desk desktop type applic you must have seen that when we click on button then we pop up a small window so in web development I also want that part so how to do that uh you can find uh a thing by the name of model model will help you to pop up a small window in which you can display anything and in bootstrap uh you will see that uh models this models so if I scroll down down just give me a second uh this is this I want to pop up this thing right so you have to copy this entire code but I have already a code so I can use that and I'll explain so here what I can do right after this part right after this part I will add some HTML code now don't worry you don't need to remember all this codee this is actually a code that I copied from bootstrap uh actually a model now in this you'll see a lot of classes IDs tab index you don't need to remember all these parts so we have a div after that we have another div this is the model dialogue this is the model content where you'll put the content and this is the header part of the model uh in which in H5 I added predicted disease this entire model represent my predicted disease okay and after that you have another div by the name of uh model body in which in ginger template SX I have printed my predicted disease now what will happen uh I'll show if I reload and go back and reload and let me put couple of uh symptoms uh this time let me add the symptoms and if I click on this uh recommendation button all this button now here if I click on this disease button now as you can see the ID is disease model so you must copy this ID and go to the button database Target and pass it right here but before that you have to add Hash Hash disease model mean when I click on this entire button I want to pop up this code this is the simple definition of model then I want to pop this thing now this is the header part where I have written predicted disease and this is my predicted disease let me show you this is the header and this is printed disease the same thing I want for all other button so let's do that as so that was the first model of disease 1 this is the second model of description I just copied the same model and past and just change uh in heading I just added description and in the body I just printed D's description now this is coming right here this one I'm printing this thing okay uh we will we will explore this part a bit later let me close this one I don't need it uh and after that now here the ID of this must be description model or any it could be any like a b c whatever you want to give but the same thing copy and past it right here in the second button and the same thing goes for all the other B buttons and I have for all the other like precaution model after that we have this m equation model and keep in mind uh we will see this part a bit later uh here I use the loops in this model in this model I use Loop in precaution model I use Loop for I in my precaution this should not be my precaution because I copied the previous code so it should be dis precaution uh dis precaution okay uh because I want to print things on new lines okay like we we have we we done exactly in the Jupiter notebook right and I also want the same thing in medication so for medication I have a variable disease medication so I'll copy this uh I want to get one by one line from disease medication and print it and I think I've done the same for workout so just give me a second where is uh go to men. Pi and work out we have one thing more uh it was this part so I have also I have to add it as well this uh D dit will be equal to D it okay this one actually so after that oops not there so I copied what I copied this description precaution medication so I'll copy this D diet so this is the workout model and where is the D model this is the D model okay so I'll copy here for I in this diet then print one by one each line in the model oops again the last one is this work out so let me check uh I'm sorry uh let me close this uh I did give me a second template let me open index.html and let me make it like this so This Di and after that we had someone workout so there should be this workout okay all right so I hope uh you get the main concept of this part so here what is going on from here from here this is the input that we are getting from user in this part and the moment we click on this recommendation button we are going to pop up all these button and the moment we click any one we click on any one of these button we are going to pop pop all this below uh uh models so let's see uh if I go back and reload the page and let's say I'm going to select uh itching skin R and cough fungal infection will be the disease this is the fungal infection this is the description of fungal infection this is the precaution okay the loop is not working here I don't know why but we we will see and this is the medication medication still are not printing that I wanted but workouts are working and in fungal died okay so it's working quite good but here in precaution we are not printing things on new line so we will figure that out so if I go to my precaution whilea model where is the precaution W model this is the description this is the precaution so I have run Loop but I think I didn't add here if I add here a zero then we will see on D pre uh there is an error I think the error was because of this thing yeah so it's mean that I can't use directly here uh if I go to precaution they are still not working so what I can do I can uh we can if I click on this now here we have a list actually it's AR so the loop must have worked so what I can do I [Music] can uh if I go to main can I make it uh if I run the same Loop right here okay this main part we will explain a bit later there are a lot of things maybe you didn't understand but uh we will see I'm thinking actually that for precaution as here at lastly I'm get the description precaution medication diet workout so what if if I run a loop here for uh I in pre uh at zero because uh I want to remove the list actually so uh this zero actually means uh if I add comment this zero means like this in my uh list I have a list I have a uh let's say n this so if I want to print just new then I can simply add here a zero like here like here and after that let me I can here declare my pre uh nmt list that will contain uh that will contain so my pr. append I yeah now in in instead of passing this pre I can update here pre to my pre so now my pre should print let's see uh let's see just if I go to precaution okay it worked uh medication so we have to do the same for medication but uh before doing that what I can do let me explain this code so what is going on from index from index.html firstly what we are getting we are getting input from form symptoms from form we are getting that symptoms within this predict okay right here we are getting them after that we are doing all the pre-processing like removing comma splitting strapping extra characters so finally we get these user symptoms so these are the clean symptoms like we we get eing and the two other one in as I have shown in the input after that I want to get the disease for that so I just pass them to the get predict function and this is right here this function with this two dictionaries and it will return me a disease let's say fungal disease and now I want to get all the recommendation for this predicted disease so I want to pass them to another function and this another function give me all the recommendation this one okay helper so it will return me four things four things uh description of that predicted disease precaution medication die and workout so after that I just want to send them to the index.html and to want to send uh something from back end like results if you want to send results and want to print on HTML file then you have to use something like render template uh that specific file name and with these variables this will be your defined variable and this will be the exact that variable that variable okay okay so now that you can print them uh as we printed okay that was the flow so if I show let me check the recording we done all things so what we left I think we left about W part uh contact W part so let's do that so very simple now if I let me close the index W part let me open about block cont and develop Pera so it mean that in about we are going to add about the project that we have done this uh system uh blah blah blah blah so very simple d. container now here let's say H1 H in H2 I want about uh control enter not control enter actually I want to go to new line so shift enter and after that in paragraph I want to write something like this after that I want to add another heading like medicine system and shift enter and for that I want paragraphs like this like this like this like this uh uh if I go to about and reload it I think I should rem load it first go to about what was the page actually it was the developer W page so sorry it was the developer so I go to developer as you can see this is right so I have written them that was the first the this one actually so let me remove this one so now uh what I can do I have already written a lot of things I'll just copy and pass so let's do that so I am in about okay uh because I have copied it from bootstrap sorry not from bootstrap from my getup uh the link I have shared so in about I have a container within container I have heading about us then welcome to the medical health where Health Ms technology for brighter healther after another our vision heading and for that I have give some explanation then another heading who we are then another explanation so if I go to my uh about W part you will see this things okay so you can change you can change them according to your name your things so I will do for all the others contact developer and blog okay so let so let me first check the recording okay now what I have done I have copied all the previous code uh that I have already written now these are simple because this this depends on you I can't put your information here just change these things accordingly okay this is a developer developer section and developer just told about you your profession like you are a machine learning engineer AI engineer then the description part all these things okay in contact add your email phone number your uh contacts right in blog about the entire project in about about the entire project with extra things so explore them okay so let me show you so finally we get this this project now let me reload it now here if I add some uh uh symptoms this is the patient symptoms click on recommendation it will give me all these things this is the disease this is the description precautions medication we already explor uh workouts and Dives okay perfect this is the about W part and this is the context section okay and this is the developer section and and this is the blog section I hope you enjoyed this project and if you have any question related to this project and if you want to add some more things to this project that you can share your knowledge your experience with me in the below comment section and I hope that you have already subscribed this Channel and like this video and share with your friend so use this project free forever all the best thank you so much