Spaces:
Sleeping
Sleeping
File size: 1,187 Bytes
b34702f d6e2b8d 281d161 d6e2b8d 281d161 d6e2b8d |
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 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
import streamlit as st
from transformers import pipeline
# Set up the sentiment analysis pipeline
pipe = pipeline("sentiment-analysis")
# Create a header for the app
st.set_page_config(page_title="Sentiment Analysis", page_icon=":chart_with_upwards_trend:", layout="wide")
st.title("Sentiment Analysis for Text")
# Add a text area for user input
text = st.text_area("Enter your text:", height=150)
# Add a button for processing the input
if st.button("Check Sentiment", key="check_button"):
if text:
with st.spinner('Analyzing...'):
out = pipe(text)
st.json(out)
else:
st.error("Please add text before checking sentiment!")
# Add some additional styling
st.markdown(
"""
<style>
.stTextInput>div>div>input {
border: 2px solid #007BFF;
border-radius: 8px;
padding: 10px;
font-size: 16px;
}
.stButton>button {
background-color: #007BFF;
color: white;
border-radius: 8px;
padding: 10px;
font-size: 16px;
border: none;
}
.stButton>button:hover {
background-color: #0056b3;
}
</style>
""", unsafe_allow_html=True
)
|