| # Streamlit App | |
| st.title("Hugging Face with Streamlit") | |
| st.subheader("Text Summarization App") | |
| # Text input | |
| user_input = st.text_area("Enter text to summarize:") | |
| # Button to generate summary | |
| if st.button("Summarize"): | |
| if user_input.strip(): | |
| # Generate summary | |
| with st.spinner("Summarizing..."): | |
| summary = summarizer(user_input, max_length=50, min_length=25, do_sample=False) | |
| st.success("Summary:") | |
| st.write(summary[0]['summary_text']) | |
| else: | |
| st.warning("Please enter some text.") | |