Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -39,7 +39,7 @@ def main():
|
|
39 |
st.sidebar.markdown("<h4 style = 'color:green; align:center; font-size: 20px;'> Model Settings</h1>", unsafe_allow_html=True)
|
40 |
max_length= st.sidebar.slider("Maximum length of the generated text",min_value=100,max_value=500)
|
41 |
min_length= st.sidebar.slider("Minimum length of the generated text",min_value=30)
|
42 |
-
model_type = st.sidebar.selectbox("Model type", options=["Bart","T5",])
|
43 |
|
44 |
# This function is used to upload a .txt, .pdf, .docx file for summarization
|
45 |
upload_doc = st.file_uploader("Upload a .txt, .pdf, .docx file for summarisation")
|
@@ -77,7 +77,16 @@ def main():
|
|
77 |
summarized_text = summarizer_model(text_to_summarize, max_length=max_length, min_length=min_length)
|
78 |
summarized_text = ' '.join([summ['summary_text'] for summ in summarized_text])
|
79 |
|
80 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
81 |
with res_col1:
|
82 |
st.subheader("Generated Text Visualisation")
|
83 |
# Create and generate a word cloud image:
|
|
|
39 |
st.sidebar.markdown("<h4 style = 'color:green; align:center; font-size: 20px;'> Model Settings</h1>", unsafe_allow_html=True)
|
40 |
max_length= st.sidebar.slider("Maximum length of the generated text",min_value=100,max_value=500)
|
41 |
min_length= st.sidebar.slider("Minimum length of the generated text",min_value=30)
|
42 |
+
model_type = st.sidebar.selectbox("Model type", options=["Bart","T5" "ssr",])
|
43 |
|
44 |
# This function is used to upload a .txt, .pdf, .docx file for summarization
|
45 |
upload_doc = st.file_uploader("Upload a .txt, .pdf, .docx file for summarisation")
|
|
|
77 |
summarized_text = summarizer_model(text_to_summarize, max_length=max_length, min_length=min_length)
|
78 |
summarized_text = ' '.join([summ['summary_text'] for summ in summarized_text])
|
79 |
|
80 |
+
elif model_type == "ssr":
|
81 |
+
text_to_summarize = clean_text
|
82 |
+
|
83 |
+
with st.spinner(
|
84 |
+
text="Loading SSR Model and Extracting summary. This might take a few seconds depending on the length of your text..."):
|
85 |
+
summarizer_model = t5()
|
86 |
+
summarized_text = summarizer_model(text_to_summarize, max_length=max_length, min_length=min_length)
|
87 |
+
summarized_text = ' '.join([summ['summary_text'] for summ in summarized_text])
|
88 |
+
|
89 |
+
res_col1 ,res_col2 = st.columns(2)
|
90 |
with res_col1:
|
91 |
st.subheader("Generated Text Visualisation")
|
92 |
# Create and generate a word cloud image:
|