Spaces:
Sleeping
Sleeping
File size: 834 Bytes
2b64fb4 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
import streamlit as st
from transformers import pipeline
summarizer = pipeline("summarization", model="facebook/bart-large-cnn")
def main():
st.title("Text Summarizer App")
input_text = st.text_area("Enter the text you want to summarize:")
# Sidebar
min_length = st.sidebar.slider("Minimum Summary Length", 10, 200, 50)
max_length = st.sidebar.slider("Maximum Summary Length", 50, 500, 100)
if st.button("Generate Summary"):
if input_text:
# Generate summary
summary = summarizer(input_text, max_length=max_length, min_length=min_length, do_sample=False)
st.subheader("Generated Summary:")
st.write(summary[0]["summary_text"])
else:
st.warning("Please enter some text to summarize.")
if __name__ == "__main__":
main()
|