Update app.py
Browse files
app.py
CHANGED
@@ -106,7 +106,7 @@ def main(myargs):
|
|
106 |
if st.session_state['input_type'] == 'File' and "embeddings_all" in st.session_state and st.session_state.embeddings_plot in ["2D", "3D"]:
|
107 |
indices = [x for x in range(st.session_state.data_df[st.session_state.input_column].values.shape[0])]
|
108 |
if "selected_indices" in st.session_state:
|
109 |
-
if len(st.session_state.selected_indices)
|
110 |
l = st.session_state.selected_indices
|
111 |
l.sort()
|
112 |
indices = l
|
@@ -164,7 +164,7 @@ def main(myargs):
|
|
164 |
plot = plotpx.scatter(
|
165 |
df_embeddings, x='x', y='y',
|
166 |
color='severity', labels={'color': 'severity'},
|
167 |
-
hover_data=['text','all_predictions','data_index'],title = 'BERT Embeddings Visualization - Please select rows (at least
|
168 |
)
|
169 |
|
170 |
else:
|
@@ -172,7 +172,7 @@ def main(myargs):
|
|
172 |
plot = plotpx.scatter_3d(
|
173 |
df_embeddings, x='x', y='y', z='z',
|
174 |
color='severity', labels={'color': 'severity'},
|
175 |
-
hover_data=['text','all_predictions','data_index'],title = 'BERT Embeddings Visualization - Please select rows (at least
|
176 |
)
|
177 |
|
178 |
st.plotly_chart(plot,use_container_width=True,)
|
@@ -223,7 +223,7 @@ def main(myargs):
|
|
223 |
st.sidebar.image(os.path.join(project_dir,"imgs/doctor.png"),use_column_width=False)
|
224 |
|
225 |
# Designing the interface
|
226 |
-
st.markdown("<h1 style='text-align: center; color: black;'>HCSBC: Hierarchical Classification System for Breast Cancer</h1>", unsafe_allow_html=True)
|
227 |
st.markdown("System Pipeline: Pathology Emory Pubmed BERT + 6 independent Machine Learning discriminators")
|
228 |
# For newline
|
229 |
st.write('\n')
|
@@ -241,7 +241,7 @@ def main(myargs):
|
|
241 |
# File selection
|
242 |
st.sidebar.title("Data Selection")
|
243 |
|
244 |
-
st.session_state['input_type'] = st.sidebar.radio("Input Selection", ('File', 'Text'), key="data_format")
|
245 |
if "prev_input_type" not in st.session_state:
|
246 |
st.session_state['prev_input_type'] = st.session_state.input_type
|
247 |
|
@@ -287,7 +287,7 @@ def main(myargs):
|
|
287 |
st.session_state['prev_input_type'] = "Text"
|
288 |
|
289 |
input_column = "Input"
|
290 |
-
data = st.sidebar.text_area("Please enter a breast cancer pathology diagnose")
|
291 |
if "user_input" in st.session_state:
|
292 |
if data != st.session_state.user_input:
|
293 |
delete_var_session(keys=["data_df","input_column","user_input","hg_df","all_l","highlight_samples","selected_indices","json_output","bert_lime_output","embeddings_all"])
|
|
|
106 |
if st.session_state['input_type'] == 'File' and "embeddings_all" in st.session_state and st.session_state.embeddings_plot in ["2D", "3D"]:
|
107 |
indices = [x for x in range(st.session_state.data_df[st.session_state.input_column].values.shape[0])]
|
108 |
if "selected_indices" in st.session_state:
|
109 |
+
if len(st.session_state.selected_indices) >=4:
|
110 |
l = st.session_state.selected_indices
|
111 |
l.sort()
|
112 |
indices = l
|
|
|
164 |
plot = plotpx.scatter(
|
165 |
df_embeddings, x='x', y='y',
|
166 |
color='severity', labels={'color': 'severity'},
|
167 |
+
hover_data=['text','all_predictions','data_index'],title = 'BERT Embeddings Visualization - Please select rows (at least 4) to display specific examples'
|
168 |
)
|
169 |
|
170 |
else:
|
|
|
172 |
plot = plotpx.scatter_3d(
|
173 |
df_embeddings, x='x', y='y', z='z',
|
174 |
color='severity', labels={'color': 'severity'},
|
175 |
+
hover_data=['text','all_predictions','data_index'],title = 'BERT Embeddings Visualization - Please select rows (at least 4) to display specific examples'
|
176 |
)
|
177 |
|
178 |
st.plotly_chart(plot,use_container_width=True,)
|
|
|
223 |
st.sidebar.image(os.path.join(project_dir,"imgs/doctor.png"),use_column_width=False)
|
224 |
|
225 |
# Designing the interface
|
226 |
+
st.markdown("<h1 style='text-align: center; color: black;'>HCSBC: Hierarchical Classification System for Breast Cancer Specimen Report</h1>", unsafe_allow_html=True)
|
227 |
st.markdown("System Pipeline: Pathology Emory Pubmed BERT + 6 independent Machine Learning discriminators")
|
228 |
# For newline
|
229 |
st.write('\n')
|
|
|
241 |
# File selection
|
242 |
st.sidebar.title("Data Selection")
|
243 |
|
244 |
+
st.session_state['input_type'] = st.sidebar.radio("Input Selection", ('File', 'Text'), key="data_format",index=1)
|
245 |
if "prev_input_type" not in st.session_state:
|
246 |
st.session_state['prev_input_type'] = st.session_state.input_type
|
247 |
|
|
|
287 |
st.session_state['prev_input_type'] = "Text"
|
288 |
|
289 |
input_column = "Input"
|
290 |
+
data = st.sidebar.text_area("Please enter a breast cancer pathology diagnose",value="BRWIRE Left wire directed segmntal mastectomy; short suture, superior; long suture, lateral breast, left, wire-directed segmental mastectomy: - infiltrating ductal carcinoma, nottingham grade i, 0.8 cm in maximum gross dimension. - ductal carcinoma in situ, low nuclear grade, solid and cribriform types, associated with microcalcifications and partially involving a small intraductal papilloma (0.2 cm). - invasive and in situ carcinoma extend to within 0.2 cm of the anterior specimen edge separately submitted margin specimen below). - no angiolymphatic invasion identifie - adjacent breast with biopsy site changes, a small intraductal papilloma (0.2 cm), and fibrocystic changes. - see synoptic report.")
|
291 |
if "user_input" in st.session_state:
|
292 |
if data != st.session_state.user_input:
|
293 |
delete_var_session(keys=["data_df","input_column","user_input","hg_df","all_l","highlight_samples","selected_indices","json_output","bert_lime_output","embeddings_all"])
|