MatthiasC commited on
Commit
8aa1525
·
1 Parent(s): b59fcf5

Fix error having no button

Browse files
Files changed (1) hide show
  1. app.py +25 -25
app.py CHANGED
@@ -180,31 +180,31 @@ with st.form("article-inpu"):
180
  article_text = st.text_area(
181
  #label='Enter the comment you want to classify below (in Dutch):')
182
  value = st.session_state.article_text)
183
- #_, rightmost_col = st.columns([6,1])
184
- #submitted = rightmost_col.form_submit_button("Classify",
185
- #help="Classify comment")
186
 
187
  # Listener
188
- # if submitted:
189
- # if text:
190
- # with st.spinner('Analysing comment...'):
191
- # classify_comment(text, selected_model)
192
- # else:
193
- # st.error('**Error**: No comment to classify. Please provide a comment.')
194
- #
195
- # # Results
196
- # if 'results' in st.session_state and st.session_state.results:
197
- # first = True
198
- # for result in st.session_state.results[::-1]:
199
- # if not first:
200
- # st.markdown("---")
201
- # st.markdown(f"Text:\n> {result['text']}")
202
- # col_1, col_2, col_3 = st.columns([1,2,2])
203
- # col_1.metric(label='', value=f"{result['emoji']}")
204
- # col_2.metric(label='Label', value=f"{result['label']}")
205
- # col_3.metric(label='Score', value=f"{result['score']:.3f}")
206
- # st.markdown(f"Token Attribution:\n{result['tokens_with_background']}",
207
- # unsafe_allow_html=True)
208
- # st.caption(f"Model: {result['model_name']}")
209
- # first = False
210
 
 
180
  article_text = st.text_area(
181
  #label='Enter the comment you want to classify below (in Dutch):')
182
  value = st.session_state.article_text)
183
+ _, rightmost_col = st.columns([6,1])
184
+ get_summary = rightmost_col.form_submit_button("Generate summary",
185
+ help="Generate summary for the given article text")
186
 
187
  # Listener
188
+ if get_summary:
189
+ if article_text:
190
+ with st.spinner('Analysing comment...'):
191
+ #classify_comment(article_text, selected_model)
192
+ else:
193
+ st.error('**Error**: No comment to classify. Please provide a comment.')
194
+
195
+ # Results
196
+ if 'results' in st.session_state and st.session_state.results:
197
+ first = True
198
+ for result in st.session_state.results[::-1]:
199
+ if not first:
200
+ st.markdown("---")
201
+ st.markdown(f"Text:\n> {result['text']}")
202
+ col_1, col_2, col_3 = st.columns([1,2,2])
203
+ col_1.metric(label='', value=f"{result['emoji']}")
204
+ col_2.metric(label='Label', value=f"{result['label']}")
205
+ col_3.metric(label='Score', value=f"{result['score']:.3f}")
206
+ st.markdown(f"Token Attribution:\n{result['tokens_with_background']}",
207
+ unsafe_allow_html=True)
208
+ st.caption(f"Model: {result['model_name']}")
209
+ first = False
210