Spaces:
Runtime error
Runtime error
Delete app.py
Browse files12345678910111213141516171819202122232425262728293031import streamlit as stfrom transformers import pipeline
# Load model (cached)@st.cache_resourcedef load_summarizer(): summarizer = pipeline("summarization", model="sshleifer/distilbart-cnn-12-6") return summarizer
summarizer = load_summarizer()
# Streamlit UIst.set_page_config(page_title="Text Summarizer", layout="centered")st.title("📝 Text Summarizer")st.markdown("Enter a long piece of text, and this app will summarize it using a Hugging Face transformer model.")
# Input boxtext_input = st.text_area("Enter your text here", height=300)
# Button to summarizeif st.button("Summarize"): if not text_input.strip(): st.warning("⚠️ Please enter some text first.") else: with st.spinner("Summarizing..."): try: summary = summarizer(text_input, max_length=130, min_length=30, do_sample=False) st.subheader("Summary:") st.success(summary[0]['summary_text']) except Exception as e: st.error(f"❌ Error during summarization: {e}")app.pyDeleted-31