Spaces:
Build error
Build error
sdhanabal1
commited on
Commit
•
ced7370
1
Parent(s):
9c2785c
Fix the summary error
Browse files
app.py
CHANGED
@@ -18,7 +18,7 @@ To use this:
|
|
18 |
def load_model():
|
19 |
with st.spinner('Please wait for the model to load...'):
|
20 |
terms_and_conditions_pipeline = pipeline(
|
21 |
-
'
|
22 |
model='ml6team/distilbart-tos-summarizer-tosdr',
|
23 |
tokenizer='ml6team/distilbart-tos-summarizer-tosdr'
|
24 |
)
|
@@ -36,15 +36,14 @@ left_area.header("Input")
|
|
36 |
form = left_area.form(key='terms-and-conditions')
|
37 |
placeholder = form.empty()
|
38 |
placeholder.empty()
|
39 |
-
|
40 |
submit_button = form.form_submit_button(label='Summarize')
|
41 |
|
42 |
-
# Right area
|
43 |
right_area.header("Output")
|
44 |
|
45 |
if submit_button:
|
46 |
-
base_text = st.session_state.
|
47 |
-
output_text = " ".join([
|
48 |
right_area.markdown('#####')
|
49 |
right_area.text_area(value=output_text, label="Summary:")
|
50 |
|
|
|
18 |
def load_model():
|
19 |
with st.spinner('Please wait for the model to load...'):
|
20 |
terms_and_conditions_pipeline = pipeline(
|
21 |
+
'summarization',
|
22 |
model='ml6team/distilbart-tos-summarizer-tosdr',
|
23 |
tokenizer='ml6team/distilbart-tos-summarizer-tosdr'
|
24 |
)
|
|
|
36 |
form = left_area.form(key='terms-and-conditions')
|
37 |
placeholder = form.empty()
|
38 |
placeholder.empty()
|
39 |
+
tc_text = placeholder.text_area(value=st.session_state.text, label='Terms and conditions text:', key='tc_text')
|
40 |
submit_button = form.form_submit_button(label='Summarize')
|
41 |
|
|
|
42 |
right_area.header("Output")
|
43 |
|
44 |
if submit_button:
|
45 |
+
base_text = st.session_state.tc_text
|
46 |
+
output_text = " ".join([result['summary_text'] for result in tc_pipeline(wrap(base_text, 512))])
|
47 |
right_area.markdown('#####')
|
48 |
right_area.text_area(value=output_text, label="Summary:")
|
49 |
|