Paula Leonova
commited on
Commit
·
42ea8fa
1
Parent(s):
c7c8a10
Update example text title
Browse files
app.py
CHANGED
@@ -30,10 +30,12 @@ if example_button:
|
|
30 |
display_text = 'Excerpt from Frankenstein:' + example_text + '"\n\n' + "[This is an excerpt from Project Gutenberg's Frankenstein. " + ex_license + "]"
|
31 |
input_labels = ex_labels
|
32 |
input_glabels = ex_glabels
|
|
|
33 |
else:
|
34 |
display_text = ''
|
35 |
input_labels = ''
|
36 |
input_glabels = ''
|
|
|
37 |
|
38 |
|
39 |
with st.form(key='my_form'):
|
@@ -123,7 +125,7 @@ if submit_button or example_button:
|
|
123 |
else:
|
124 |
|
125 |
if len(text_input) != 0:
|
126 |
-
text_df = pd.DataFrame.from_dict({'title': [
|
127 |
|
128 |
# OPTION A
|
129 |
elif uploaded_text_files is not None:
|
@@ -270,12 +272,12 @@ if submit_button or example_button:
|
|
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=
|
279 |
else:
|
280 |
label_match_df = labels_full_df.copy()
|
281 |
|
@@ -296,7 +298,7 @@ if submit_button or example_button:
|
|
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)
|
300 |
st.download_button(
|
301 |
label="Download data as CSV",
|
302 |
data=label_match_df.to_csv().encode('utf-8'),
|
|
|
30 |
display_text = 'Excerpt from Frankenstein:' + example_text + '"\n\n' + "[This is an excerpt from Project Gutenberg's Frankenstein. " + ex_license + "]"
|
31 |
input_labels = ex_labels
|
32 |
input_glabels = ex_glabels
|
33 |
+
title_name = 'Frankenstein, Chapter 3'
|
34 |
else:
|
35 |
display_text = ''
|
36 |
input_labels = ''
|
37 |
input_glabels = ''
|
38 |
+
title_name = 'Submitted Text'
|
39 |
|
40 |
|
41 |
with st.form(key='my_form'):
|
|
|
125 |
else:
|
126 |
|
127 |
if len(text_input) != 0:
|
128 |
+
text_df = pd.DataFrame.from_dict({'title': [title_name], 'text': [text_input]})
|
129 |
|
130 |
# OPTION A
|
131 |
elif uploaded_text_files is not None:
|
|
|
272 |
|
273 |
with st.expander(f'({i+1}/{len(text_df)}) See intermediate label matching results for: {text_df["title"][i]}'):
|
274 |
if gen_summary == 'Yes':
|
275 |
+
st.dataframe(pd.merge(ls_df, lf_df, on=['title','label']))
|
276 |
else:
|
277 |
st.dataframe(lf_df)
|
278 |
|
279 |
if gen_summary == 'Yes':
|
280 |
+
label_match_df = pd.merge(labels_sum_df, labels_full_df, on=['title', 'label'])
|
281 |
else:
|
282 |
label_match_df = labels_full_df.copy()
|
283 |
|
|
|
298 |
label_match_df = pd.merge(label_match_df, gdata, how='left', on=join_list)
|
299 |
label_match_df['correct_match'].fillna(False, inplace=True)
|
300 |
|
301 |
+
st.dataframe(label_match_df) #.sort_values(['title', 'label'], ascending=[False, False]))
|
302 |
st.download_button(
|
303 |
label="Download data as CSV",
|
304 |
data=label_match_df.to_csv().encode('utf-8'),
|