Paula Leonova commited on
Commit
bf19bee
1 Parent(s): d4be6e6

Add both summary and full text eval metrics

Browse files
Files changed (1) hide show
  1. app.py +12 -6
app.py CHANGED
@@ -115,7 +115,6 @@ if submit_button:
115
  data2['is_true_label'].fillna(0, inplace = True)
116
 
117
  st.markdown("### Data Table")
118
-
119
  with st.spinner('Generating a table of results and a download link...'):
120
  coded_data = base64.b64encode(data2.to_csv(index = False). encode ()).decode()
121
  st.markdown(
@@ -125,12 +124,19 @@ if submit_button:
125
  st.dataframe(data2)
126
 
127
  if len(glabels) > 0:
 
128
  with st.spinner('Evaluating output against ground truth...'):
129
- report = classification_report(y_true = data2[['is_true_label']],
130
- y_pred = (data2[['scores_from_full_text']] >= threshold_value) * 1.0,
131
- output_dict=True)
132
- df_report = pd.DataFrame(report).transpose()
133
- st.dataframe(df_report)
 
 
 
 
 
 
134
 
135
  st.success('All done!')
136
  st.balloons()
 
115
  data2['is_true_label'].fillna(0, inplace = True)
116
 
117
  st.markdown("### Data Table")
 
118
  with st.spinner('Generating a table of results and a download link...'):
119
  coded_data = base64.b64encode(data2.to_csv(index = False). encode ()).decode()
120
  st.markdown(
 
124
  st.dataframe(data2)
125
 
126
  if len(glabels) > 0:
127
+ st.markdown("### Evaluation Metrics")
128
  with st.spinner('Evaluating output against ground truth...'):
129
+
130
+ section_header_description = ['Summary Label Performance', 'Original Full Text Label Performance']
131
+ data_headers = ['scores_from_summary', 'scores_from_full_text']
132
+ for i in range(0,2):
133
+ st.markdown(f"##### {section_header_description[i]}")
134
+ report = classification_report(y_true = data2[['is_true_label']],
135
+ y_pred = (data2[[data_headers[i]]] >= threshold_value) * 1.0,
136
+ output_dict=True)
137
+ df_report = pd.DataFrame(report).transpose()
138
+ st.markdown(f"Threshold set for: {threshold_value}")
139
+ st.dataframe(df_report)
140
 
141
  st.success('All done!')
142
  st.balloons()