arpy8 commited on
Commit
6b48a2c
1 Parent(s): e8e50ac

update app

Browse files
_contributors.py DELETED
@@ -1,6 +0,0 @@
1
- import streamlit as st
2
- from config import CONTRIBUTORS
3
-
4
- def contributors_page():
5
- st.balloons()
6
- st.write(CONTRIBUTORS, unsafe_allow_html=True)
 
 
 
 
 
 
 
assets/members_list.txt ADDED
Binary file (3.88 kB). View file
 
config.py CHANGED
@@ -75,56 +75,10 @@ CONTRIBUTORS = """
75
  </table>
76
  <br>
77
  <table>
78
- <tbody>
79
- <tr>
80
- <th width="20%" style="font-size: 140%;" colspan="3">Contributors</th>
81
- </tr>
82
- <tr>
83
- <td>John Doe</td>
84
- <td>John Doe</td>
85
- <td>John Doe</td>
86
- </tr>
87
- <tr>
88
- <td>John Doe</td>
89
- <td>John Doe</td>
90
- <td>John Doe</td>
91
- </tr>
92
- <tr>
93
- <td>John Doe</td>
94
- <td>John Doe</td>
95
- <td>John Doe</td>
96
- </tr>
97
- <tr>
98
- <td>John Doe</td>
99
- <td>John Doe</td>
100
- <td>John Doe</td>
101
- </tr>
102
- <tr>
103
- <td>John Doe</td>
104
- <td>John Doe</td>
105
- <td>John Doe</td>
106
- </tr>
107
- <tr>
108
- <td>John Doe</td>
109
- <td>John Doe</td>
110
- <td>John Doe</td>
111
- </tr>
112
- <tr>
113
- <td>John Doe</td>
114
- <td>John Doe</td>
115
- <td>John Doe</td>
116
- </tr>
117
- <tr>
118
- <td>John Doe</td>
119
- <td>John Doe</td>
120
- <td>John Doe</td>
121
- </tr>
122
- <tr>
123
- <td>John Doe</td>
124
- <td>John Doe</td>
125
- <td>John Doe</td>
126
- </tr>
127
- </tbody>
128
  </table>
129
  </div>
130
  """
 
75
  </table>
76
  <br>
77
  <table>
78
+ <tr>
79
+ <th width="20%" style="font-size: 140%;" colspan="3">Contributors</th>
80
+ </tr>
81
+ {}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
82
  </table>
83
  </div>
84
  """
contributors.py ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ from config import CONTRIBUTORS
3
+
4
+ def contributors_page():
5
+ st.balloons()
6
+ with open("assets/members_list.txt", "r", encoding="utf-16") as f:
7
+ data = f.readlines()
8
+
9
+ full_string = ""
10
+
11
+ for i in range(0,len(data),3):
12
+ contributors = f"""<tr>
13
+ <td>{data[i].strip().title()}</td>
14
+ <td>{data[i+1].strip().title()}</td>
15
+ <td>{data[i+2].strip().title()}</td>
16
+ </tr>
17
+ """
18
+ full_string += contributors
19
+
20
+ st.write(CONTRIBUTORS.format(full_string), unsafe_allow_html=True)
21
+
22
+ if __name__ == "__main__":
23
+ contributors_page()
main.py CHANGED
@@ -2,8 +2,8 @@ import base64
2
  import streamlit as st
3
 
4
  from config import *
5
- from _model import model_page
6
- from _contributors import contributors_page
7
 
8
  st.set_page_config(
9
  page_title=f"Omdena | Toronto Chapter",
@@ -59,15 +59,13 @@ def home_page():
59
  def main():
60
  st.sidebar.image("assets/logo.png")
61
  st.sidebar.write(SIDEBAR_TEXT_1, unsafe_allow_html=True)
62
- selected_task = st.sidebar.selectbox("Please navigate through the different sections of our website from here", ["Home", "About", "Visualization", "Model", "Contributors"], label_visibility="hidden")
63
  st.sidebar.write(SIDEBAR_TEXT_2, unsafe_allow_html=True)
64
 
65
  if selected_task == "Home":
66
  home_page()
67
  elif selected_task == "About":
68
  st.write(ABOUT_US, unsafe_allow_html=True)
69
- elif selected_task == "Visualization":
70
- st.write(VISUALIZATION, unsafe_allow_html=True)
71
  elif selected_task == "Model":
72
  model_page()
73
  elif selected_task == "Contributors":
 
2
  import streamlit as st
3
 
4
  from config import *
5
+ from model import model_page
6
+ from contributors import contributors_page
7
 
8
  st.set_page_config(
9
  page_title=f"Omdena | Toronto Chapter",
 
59
  def main():
60
  st.sidebar.image("assets/logo.png")
61
  st.sidebar.write(SIDEBAR_TEXT_1, unsafe_allow_html=True)
62
+ selected_task = st.sidebar.selectbox("Please navigate through the different sections of our website from here", ["Home", "About", "Model", "Contributors"], label_visibility="hidden")
63
  st.sidebar.write(SIDEBAR_TEXT_2, unsafe_allow_html=True)
64
 
65
  if selected_task == "Home":
66
  home_page()
67
  elif selected_task == "About":
68
  st.write(ABOUT_US, unsafe_allow_html=True)
 
 
69
  elif selected_task == "Model":
70
  model_page()
71
  elif selected_task == "Contributors":
_model.py → model.py RENAMED
@@ -3,8 +3,8 @@ import streamlit as st
3
  from config import API_URL, CLASS_LABELS
4
 
5
  def model_page():
6
- st.write("#### Upload brain x-ray image here...")
7
- uploaded_file = st.file_uploader("Upload brain x-ray image here...", type=["jpg", "png", "jpeg"], label_visibility="hidden")
8
  predict_button = st.button("ㅤㅤPredictㅤㅤ")
9
 
10
  if predict_button and uploaded_file:
@@ -15,11 +15,12 @@ def model_page():
15
  label = CLASS_LABELS[int(result['label'])]
16
  prob = round(result['probability'], 4)*100
17
 
18
- result_ele.info(f"""According to our diagnosis, there is a **{prob}%** chance that you are **{label}**.""")
 
19
  st.toast("Prediction completed!", icon="🎉")
20
 
21
  elif predict_button and not uploaded_file:
22
- st.toast("Please upload an image first!", icon="⚠️")
23
 
24
  def predict_image(image):
25
  files = {'file': image}
 
3
  from config import API_URL, CLASS_LABELS
4
 
5
  def model_page():
6
+ st.write("#### Please upload MRI scan here...")
7
+ uploaded_file = st.file_uploader("Upload MRI scan here...", type=["jpg", "png", "jpeg"], label_visibility="hidden")
8
  predict_button = st.button("ㅤㅤPredictㅤㅤ")
9
 
10
  if predict_button and uploaded_file:
 
15
  label = CLASS_LABELS[int(result['label'])]
16
  prob = round(result['probability'], 4)*100
17
 
18
+ # According to our model, there is a 99.97% chance that this scan is from a non demented person.
19
+ result_ele.info(f"""According to our model, there is a **{prob}%** chance that this scan is from a **{label}** person.""")
20
  st.toast("Prediction completed!", icon="🎉")
21
 
22
  elif predict_button and not uploaded_file:
23
+ st.toast("Please upload an MRI scan first!", icon="⚠️")
24
 
25
  def predict_image(image):
26
  files = {'file': image}