|
import streamlit as st |
|
import pickle |
|
|
|
|
|
|
|
hide_streamlit_style = """ |
|
<style> |
|
#MainMenu {visibility: hidden;} |
|
footer {visibility: hidden;} |
|
</style> |
|
""" |
|
|
|
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) |
|
|
|
|
|
|
|
|
|
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] |
|
|
|
|
|
|
|
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): ", "") |
|
|
|
if(st.button('Submit')): |
|
a=a1 |
|
b=b1 |
|
c=c1 |
|
d=d1 |
|
e=e1 |
|
f=f1 |
|
g=g1 |
|
h=h1 |
|
i=i1 |
|
|
|
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') |
|
|
|
|
|
while True: |
|
default() |
|
pred() |
|
break |
|
print(dlt) |