Paula Leonova
commited on
Commit
•
c7c8a10
1
Parent(s):
c0937ef
Fix ground labels matching
Browse files
app.py
CHANGED
@@ -268,12 +268,11 @@ if submit_button or example_button:
|
|
268 |
lf_df['title'] = text_df['title'][i]
|
269 |
labels_full_df = pd.concat([labels_full_df, lf_df[labels_full_col_list]])
|
270 |
|
271 |
-
with st.expander(f'({i+1}/{len(text_df)}) See intermediate label matching results'):
|
272 |
-
st.write(f"Results for: {text_df['title'][i]}")
|
273 |
if gen_summary == 'Yes':
|
274 |
-
st.dataframe(pd.merge(
|
275 |
else:
|
276 |
-
st.dataframe(
|
277 |
|
278 |
if gen_summary == 'Yes':
|
279 |
label_match_df = pd.merge(labels_sum_df, labels_full_df, on=title_element + ['label'])
|
@@ -286,13 +285,15 @@ if submit_button or example_button:
|
|
286 |
elif uploaded_onetext_glabels_file is not None:
|
287 |
gdata = pd.read_csv(uploaded_onetext_glabels_file, header=None)
|
288 |
join_list = ['label']
|
|
|
289 |
elif uploaded_multitext_glabels_file is not None:
|
290 |
gdata = pd.read_csv(uploaded_multitext_glabels_file)
|
291 |
join_list = ['title', 'label']
|
|
|
292 |
|
293 |
if len(glabels) > 0 or uploaded_onetext_glabels_file is not None or uploaded_multitext_glabels_file is not None:
|
294 |
gdata['correct_match'] = True
|
295 |
-
label_match_df = pd.merge(label_match_df, gdata, how='
|
296 |
label_match_df['correct_match'].fillna(False, inplace=True)
|
297 |
|
298 |
st.dataframe(label_match_df)
|
|
|
268 |
lf_df['title'] = text_df['title'][i]
|
269 |
labels_full_df = pd.concat([labels_full_df, lf_df[labels_full_col_list]])
|
270 |
|
271 |
+
with st.expander(f'({i+1}/{len(text_df)}) See intermediate label matching results for: {text_df["title"][i]}'):
|
|
|
272 |
if gen_summary == 'Yes':
|
273 |
+
st.dataframe(pd.merge(ls_df, lf_df, on=['label']))
|
274 |
else:
|
275 |
+
st.dataframe(lf_df)
|
276 |
|
277 |
if gen_summary == 'Yes':
|
278 |
label_match_df = pd.merge(labels_sum_df, labels_full_df, on=title_element + ['label'])
|
|
|
285 |
elif uploaded_onetext_glabels_file is not None:
|
286 |
gdata = pd.read_csv(uploaded_onetext_glabels_file, header=None)
|
287 |
join_list = ['label']
|
288 |
+
gdata.columns = join_list
|
289 |
elif uploaded_multitext_glabels_file is not None:
|
290 |
gdata = pd.read_csv(uploaded_multitext_glabels_file)
|
291 |
join_list = ['title', 'label']
|
292 |
+
gdata.columns = join_list
|
293 |
|
294 |
if len(glabels) > 0 or uploaded_onetext_glabels_file is not None or uploaded_multitext_glabels_file is not None:
|
295 |
gdata['correct_match'] = True
|
296 |
+
label_match_df = pd.merge(label_match_df, gdata, how='left', on=join_list)
|
297 |
label_match_df['correct_match'].fillna(False, inplace=True)
|
298 |
|
299 |
st.dataframe(label_match_df)
|