Abdelrhman-Elruby
commited on
Commit
•
4777d1a
1
Parent(s):
2d29538
modified: main.py
Browse files
main.py
CHANGED
@@ -62,7 +62,7 @@ def pred(img,radio,selbox,check):
|
|
62 |
if check:
|
63 |
pred=pd.DataFrame({
|
64 |
'class_name' : result,
|
65 |
-
'pred_score' : pred.flatten()
|
66 |
})
|
67 |
return pred
|
68 |
pred = np.argmax(pred, axis=1)
|
@@ -93,24 +93,26 @@ def home_page():
|
|
93 |
st.session_state.image=st.file_uploader('Upload MRI Image',accept_multiple_files=False,type=['png', 'jpg','jpeg'],key="upload",on_change=update_photo)
|
94 |
if st.session_state.image != None:
|
95 |
st.image(st.session_state.image,width=300)
|
96 |
-
|
97 |
-
|
|
|
98 |
if radio =='Brain Tumor Detection':
|
99 |
-
selbox=
|
100 |
else:
|
101 |
-
selbox=
|
102 |
-
|
|
|
103 |
if state:
|
104 |
f=open(st.session_state.image.name, 'wb')
|
105 |
f.write(st.session_state.image.getbuffer())
|
106 |
f.close()
|
107 |
|
108 |
-
|
109 |
|
110 |
|
111 |
|
112 |
def About_page():
|
113 |
-
st.
|
114 |
|
115 |
def main():
|
116 |
spr_sidebar()
|
|
|
62 |
if check:
|
63 |
pred=pd.DataFrame({
|
64 |
'class_name' : result,
|
65 |
+
'pred_score' : pred.flatten()*100
|
66 |
})
|
67 |
return pred
|
68 |
pred = np.argmax(pred, axis=1)
|
|
|
93 |
st.session_state.image=st.file_uploader('Upload MRI Image',accept_multiple_files=False,type=['png', 'jpg','jpeg'],key="upload",on_change=update_photo)
|
94 |
if st.session_state.image != None:
|
95 |
st.image(st.session_state.image,width=300)
|
96 |
+
col,col2=st.columns([2,3])
|
97 |
+
radio=col.radio("Model",options=('Brain Tumor Detection','Alzheimer Detection'),key='radio',on_change=update_radio)
|
98 |
+
check=col.checkbox('Show Prediction Scores',key='check',on_change=update_check)
|
99 |
if radio =='Brain Tumor Detection':
|
100 |
+
selbox=col2.selectbox("choose a number of Classes",options=('44 Classes','17 Classes' ,'15 Classes','2 Classes'),index=0,key='box',on_change=update_selbox)
|
101 |
else:
|
102 |
+
selbox=col2.radio("choose a number of Classes",options=(['4 Classes']),index=0,key='box1',on_change=update_selbox)
|
103 |
+
|
104 |
+
state =col.button('Get Result')
|
105 |
if state:
|
106 |
f=open(st.session_state.image.name, 'wb')
|
107 |
f.write(st.session_state.image.getbuffer())
|
108 |
f.close()
|
109 |
|
110 |
+
col2.write(pred(st.session_state.image.name,radio,selbox,check))
|
111 |
|
112 |
|
113 |
|
114 |
def About_page():
|
115 |
+
st.error("Nothing Here yet")
|
116 |
|
117 |
def main():
|
118 |
spr_sidebar()
|