Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -7,16 +7,19 @@ summarizer = pipeline("summarization", model="facebook/bart-large-cnn")
|
|
| 7 |
# Streamlit App
|
| 8 |
st.title("Summarization App")
|
| 9 |
|
| 10 |
-
# Input text area
|
| 11 |
-
article = st.text_area("Enter the article:",
|
| 12 |
|
| 13 |
if st.button("Generate Summary"):
|
| 14 |
-
|
| 15 |
-
|
|
|
|
| 16 |
|
| 17 |
-
|
| 18 |
-
|
| 19 |
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
|
|
|
|
|
|
|
|
| 7 |
# Streamlit App
|
| 8 |
st.title("Summarization App")
|
| 9 |
|
| 10 |
+
# Input text area for user to enter the article
|
| 11 |
+
article = st.text_area("Enter the article:", "", height=300)
|
| 12 |
|
| 13 |
if st.button("Generate Summary"):
|
| 14 |
+
if article:
|
| 15 |
+
# Generate summary using the summarizer pipeline
|
| 16 |
+
summary_result = summarizer(article, max_length=130, min_length=30, do_sample=False)
|
| 17 |
|
| 18 |
+
# Extract the summary text
|
| 19 |
+
summary_text = summary_result[0]['summary_text']
|
| 20 |
|
| 21 |
+
# Display the summary
|
| 22 |
+
st.subheader("Summary:")
|
| 23 |
+
st.write(summary_text)
|
| 24 |
+
else:
|
| 25 |
+
st.warning("Please enter an article for summarization.")
|