Spaces:
Paused
Paused
import joblib | |
import sklearn | |
import pandas as pd | |
import numpy as np | |
loaded_rf = joblib.load("model_joblib") | |
Description=pd.read_csv("symptom_Description.csv") | |
severity=pd.read_csv("Symptom-severity.csv") | |
severity['Symptom'] = severity['Symptom'].str.replace('_',' ') | |
precaution = pd.read_csv("symptom_precaution.csv") | |
def predd(x,S1,S2,S3,S4,S5,S6,S7,S8,S9,S10,S11,S12,S13,S14,S15,S16,S17): | |
psymptoms = [S1,S2,S3,S4,S5,S6,S7,S8,S9,S10,S11,S12,S13,S14,S15,S16,S17] | |
#print(psymptoms) | |
a = np.array(severity["Symptom"]) | |
b = np.array(severity["weight"]) | |
for j in range(len(psymptoms)): | |
for k in range(len(a)): | |
if psymptoms[j]==a[k]: | |
psymptoms[j]=b[k] | |
psy = [psymptoms] | |
pred2 = x.predict(psy) | |
disp= Description[Description['Disease']==pred2[0]] | |
disp = disp.values[0][1] | |
recomnd = precaution[precaution['Disease']==pred2[0]] | |
c=np.where(precaution['Disease']==pred2[0])[0][0] | |
precuation_list=[] | |
for i in range(1,len(precaution.iloc[c])): | |
precuation_list.append(precaution.iloc[c,i]) | |
print("The Disease Name: ",pred2[0]) | |
print("The Disease Discription: ",disp) | |
print("Recommended Things to do at home: ") | |
for i in precuation_list: | |
print(" -",i) | |
""" | |
predd(loaded_rf,'high fever','sunken eyes','breathlessness',0,0,0,0,0,0,0,'sweating',0,0,0,0,0,0) | |
""" |