RaviChandera's picture
Update app.py
634eed9
import streamlit as st
from transformers import pipeline
# Set page layout and style
st.set_page_config(
page_title="summarizer",
layout="wide",
initial_sidebar_state="expanded",
)
st.markdown(
"""
<style>
.stTextInput > div > div > input {
background-color: #f5f5f5;
border-radius: 5px;
padding: 10px;
font-size: 16px;
}
.stButton > button:first-child {
background-color: #3366ff;
color: white;
font-size: 16px;
padding: 10px 20px;
border-radius: 5px;
border: none;
}
</style>
""",
unsafe_allow_html=True,
)
# Set up sentiment analysis pipeline
summarizer = pipeline("summarization")
# Streamlit app
st.title("Summarization")
text = st.text_area("Enter text")
if st.button("Analyze"):
if text:
out = summarizer(text)
st.subheader("Summarization Result:")
summary = summarizer(text, max_length=1500, min_length=80, do_sample=False)[0]["summary_text"]
st.write(summary)
else:
st.warning("Please enter some text.")