Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -34,7 +34,7 @@ def preprocess_text(x):
|
|
34 |
|
35 |
@st.cache(allow_output_mutation=True)
|
36 |
def extractive_model():
|
37 |
-
model = Summarizer()
|
38 |
return model
|
39 |
|
40 |
@st.cache(allow_output_mutation=True)
|
@@ -91,9 +91,9 @@ if summarize:
|
|
91 |
with st.spinner(text="Loading Model and creating summary. This might take a few seconds depending on the length of your text..."):
|
92 |
model = model()
|
93 |
#summarized_text = text_to_summarize if len(text_to_summarize) > 60 else ''.join(model(body, min_length=60))
|
94 |
-
min_ = min(
|
95 |
-
max_ = min(
|
96 |
-
summarized_text = ''.join(model(text_to_summarize, min_length=min_,max_length=max_)) if summary_type == "Extractive" else model(text_to_summarize, min_length=min_,max_length=max_)[0]['summary_text']
|
97 |
|
98 |
st.subheader("Original text")
|
99 |
st.write(text_to_summarize)
|
|
|
34 |
|
35 |
@st.cache(allow_output_mutation=True)
|
36 |
def extractive_model():
|
37 |
+
model = Summarizer('distilbert-base-uncased')
|
38 |
return model
|
39 |
|
40 |
@st.cache(allow_output_mutation=True)
|
|
|
91 |
with st.spinner(text="Loading Model and creating summary. This might take a few seconds depending on the length of your text..."):
|
92 |
model = model()
|
93 |
#summarized_text = text_to_summarize if len(text_to_summarize) > 60 else ''.join(model(body, min_length=60))
|
94 |
+
min_ = min(80,len(text_to_summarize)/5)
|
95 |
+
max_ = min(400,len(text_to_summarize)/2)
|
96 |
+
summarized_text = ''.join(model(text_to_summarize, min_length=min_,max_length=max_,ratio=0.2)) if summary_type == "Extractive" else model(text_to_summarize, min_length=min_,max_length=max_)[0]['summary_text']
|
97 |
|
98 |
st.subheader("Original text")
|
99 |
st.write(text_to_summarize)
|