Spaces:
Sleeping
Sleeping
File size: 783 Bytes
bf7b3cb |
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 28 29 |
import streamlit as st
from transformers import pipeline
# Load the summarization pipeline
summarizer = pipeline("summarization")
def summarize_text(text):
"""Summarize the input text using Hugging Face's pipeline."""
summary = summarizer(text, max_length=150, min_length=50, do_sample=False)
return summary[0]['summary_text']
# Streamlit UI
st.title("Text Summarization with Hugging Face")
st.write("Enter the text you want to summarize:")
# Text input from the user
user_input = st.text_area("Input Text", height=200)
if st.button("Summarize"):
if user_input:
# Generate summary
summary = summarize_text(user_input)
st.subheader("Summary:")
st.write(summary)
else:
st.error("Please enter some text to summarize.")
|