File size: 5,519 Bytes
896d93f |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 |
import streamlit as st
import pickle
# @st.cache(allow_output_mutation=True)
hide_streamlit_style = """
<style>
#MainMenu {visibility: hidden;}
footer {visibility: hidden;}
</style>
"""
# st.markdown('<center style="opacity: 70%">OR</center>', unsafe_allow_html=True)
st.markdown(hide_streamlit_style, unsafe_allow_html=True)
st.title('MedicBot')
w1=0
w2=0
w3=0
st.markdown('#### Welcome may I know your symptoms:')
def default():
global w1,w2,w3
qq1 = st.selectbox("Feeling dizzy or tierd: ", ('No', 'Yes'))
q1=0
qq2=st.selectbox("Feeling hungry more often than useual: ", ('No', 'Yes'))
q2=0
qq3=st.selectbox("Having a blurryvision recently: ", ('No', 'Yes'))
q3=0
qq4=st.selectbox("Having chest pain",('No', 'Yes'))
q4=0
qq5=st.selectbox("Gender",('Male', 'Female'))
q5=0
qq6=st.selectbox("Asyncronus heart rythm:",('No', 'Yes'))
q6=0
qq7=st.selectbox("Cough?",('No', 'Yes'))
q7=0
qq8=st.selectbox("Throat soarness?",('No', 'Yes'))
q8=0
qq9=st.selectbox("Loss in smell or taste?",('No', 'Yes'))
q9=0
if(st.button('Submit.')):
if (qq1 == 'Yes'):
q1=1
if (qq2=='Yes'):
q2=1
if (qq3=='Yes'):
q3=1
if (qq4=='Yes'):
q4=1
if (qq5=='Female'):
q5=1
if (qq6=='Yes'):
q6=1
if (qq7=='Yes'):
q7=1
if (qq8=='Yes'):
q8=1
if (qq9=='Yes'):
q9=1
w1=int(q1)+int(q2)+int(q3)
w2=int(q5)+int(q6)+int(q4)
w3=int(q7)+int(q8)+int(q9)
# pred()
def diaques():
st.markdown('')
a1=st.text_input("Enter the no.of pregnencies : ", "")
b1=st.text_input("Enter the blood glucose level (0-200): ", "")
c1=st.text_input("Enter the blood pressure (0-125): ", "")
d1=st.text_input("Enter the skinthickness: (0-110): ", "")
e1=st.text_input("Enter the insulin levels: (0-750): ", "")
f1=st.text_input("Enter the BMI (0--): ", "")
g1=st.text_input("enter age: ", "")
if(st.button('Submit')):
a=a1
b=b1
c=c1
d=d1
e=e1
f=f1
g=g1
return [a,b,c,d,e,f,g]
# print(diaques())
def coviques():
a1=st.text_input("Are you having any breathing problems(0 or 1): ", "")
b1=st.text_input("Are you having any fever (0 or 1): ", "")
c1=st.text_input("Are you having Dry cough (0 or 1): ", "")
d1=st.text_input("Having Sore thoart (0 or 1): ", "")
e1=st.text_input("Having Running Nose (0 or 1): ", "")
f1=st.text_input("Having Asthma (0 or 1): ", "")
g1=st.text_input("Having Headache (0 or 1): ", "")
h1=st.text_input("Having Hyper Tension (0 or 1): ", "")
i1=st.text_input("Having Fatigue (0 or 1): ", "")
j1=st.text_input("recently in contact with any covid patient (0 or 1): ", "")
if(st.button('Submit')):
a=a1
b=b1
c=c1
d=d1
e=e1
f=f1
g=g1
h=h1
i=i1
j=j1
return [a,b,c,d,e,f,g,h,i,j]
def heartattques():
a1=st.text_input("Enter age: ", "")
b1=st.text_input("Enter Gender (0-F & 1-M): ", "")
c1=st.text_input("Enter chest pain level (0,1,2,3): ", "")
d1=st.text_input("Enter Resting Blood pressure: ", "")
e1=st.text_input("nter blood cholestrol( 125-570): ", "")
f1=st.text_input("Fasting blood sugar if >120mg/dl (0 or 1): ", "")
g1=st.text_input("Resting ecg (0,1,2): ", "")
h1=st.text_input("Max heart rate recorded(bpm): ", "")
i1=st.text_input("is there any exercise induced angina(0 or 1): ", "")
# j1=st.text_input("recently in contact with any covid patient (0 or 1): ", "")
if(st.button('Submit')):
a=a1
b=b1
c=c1
d=d1
e=e1
f=f1
g=g1
h=h1
i=i1
# j=j1
return [a,b,c,d,e,f,g,h,i]
dlt=[]
def pred():
global w1,w2,w3
if max(w1,w2,w3)==w1:
lt=diaques()
mo=pickle.load(open(r"C:\Users\kumar\Documents\predproj\diab_pred.sav",'rb'))
if mo.predict([lt])==1:
dlt.append('Diabetes')
elif max(w1,w2,w3)==w2:
lt=heartattques()
mo=pickle.load(open(r"C:\Users\kumar\Documents\predproj\heartatt_pred.sav",'rb'))
if mo.predict([lt])==1:
dlt.append('Heart attack')
elif max(w1,w2,w3)==w3:
lt=coviques()
mo=pickle.load(open(r"C:\Users\kumar\Documents\predproj\covid_pred.sav",'rb'))
if mo.predict([lt])==1:
dlt.append('Covid')
elif max(w1,w2,w3)==w1 and max(w1,w2,w3)==w2:
lt=diaques()
mo=pickle.load(open(r"C:\Users\kumar\Documents\predproj\diab_pred.sav",'rb'))
if mo.predict([lt])==1:
dlt.append('Diabetes')
lt=heartattques()
mo=pickle.load(open(r"C:\Users\kumar\Documents\predproj\heartatt_pred.sav",'rb'))
if mo.predict([lt])==1:
dlt.append('Heart attack')
elif max(w1,w2,w3)==w1 and max(w1,w2,w3)==w3:
lt=diaques()
mo=pickle.load(open(r"C:\Users\kumar\Documents\predproj\diab_pred.sav",'rb'))
if mo.predict([lt])==1:
dlt.append('Diabetes')
lt=coviques()
mo=pickle.load(open(r"C:\Users\kumar\Documents\predproj\covid_pred.sav",'rb'))
if mo.predict([lt])==1:
dlt.append('Covid')
# default()
while True:
default()
pred()
break
print(dlt) |