Spaces:
Build error
Build error
Commit
·
133c41f
1
Parent(s):
6977cda
Add spinner during computation
Browse files
app.py
CHANGED
|
@@ -66,28 +66,28 @@ def main() -> None:
|
|
| 66 |
st.write('<style>div.row-widget.stRadio > div{flex-direction:row;}</style>', unsafe_allow_html=True)
|
| 67 |
st.header("Input")
|
| 68 |
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
|
| 91 |
|
| 92 |
display_abstractive_summary(abstract_summary_list)
|
| 93 |
display_extractive_summary(tc_text_input, extract_summary_sentences)
|
|
|
|
| 66 |
st.write('<style>div.row-widget.stRadio > div{flex-direction:row;}</style>', unsafe_allow_html=True)
|
| 67 |
st.header("Input")
|
| 68 |
|
| 69 |
+
sentences_length_input = st.number_input(
|
| 70 |
+
label='Number of sentences to be extracted:',
|
| 71 |
+
min_value=1,
|
| 72 |
+
value=st.session_state.sentences_length
|
| 73 |
+
)
|
| 74 |
+
tc_text_input = st.text_area(
|
| 75 |
+
value=st.session_state.tc_text,
|
| 76 |
+
label='Terms & conditions content or specify an URL:',
|
| 77 |
+
height=240
|
| 78 |
+
)
|
| 79 |
+
|
| 80 |
+
summarize_button = st.button(label='Summarize')
|
| 81 |
+
|
| 82 |
+
if summarize_button:
|
| 83 |
+
|
| 84 |
+
with st.spinner('Summarizing the text...'):
|
| 85 |
+
if is_valid_url(tc_text_input):
|
| 86 |
+
extract_summary_sentences = summarizer.extractive_summary_from_url(tc_text_input, sentences_length_input)
|
| 87 |
+
else:
|
| 88 |
+
extract_summary_sentences = summarizer.extractive_summary_from_text(tc_text_input, sentences_length_input)
|
| 89 |
+
|
| 90 |
+
abstract_summary_list = summarizer.abstractive_summary(extract_summary_sentences)
|
| 91 |
|
| 92 |
display_abstractive_summary(abstract_summary_list)
|
| 93 |
display_extractive_summary(tc_text_input, extract_summary_sentences)
|