Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -6,7 +6,7 @@ sentiment_classifier = pipeline("text-classification",model='Ryleeeee/CustomSent
|
|
| 6 |
|
| 7 |
# Streamlit application title and background image
|
| 8 |
st.image("./header.png", use_column_width=True)
|
| 9 |
-
st.
|
| 10 |
|
| 11 |
st.write("Setiment classification: positive, netural, negative")
|
| 12 |
|
|
@@ -25,9 +25,12 @@ def sentiment_class(text):
|
|
| 25 |
|
| 26 |
|
| 27 |
# Perform sentiment analysis when the user clicks the "Classify Sentiment" button
|
| 28 |
-
if
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
|
|
|
|
|
|
|
|
|
| 33 |
|
|
|
|
| 6 |
|
| 7 |
# Streamlit application title and background image
|
| 8 |
st.image("./header.png", use_column_width=True)
|
| 9 |
+
st.markdown("<h1 style='text-align: center;'>Customer Review Analysis</h1>", unsafe_allow_html=True)
|
| 10 |
|
| 11 |
st.write("Setiment classification: positive, netural, negative")
|
| 12 |
|
|
|
|
| 25 |
|
| 26 |
|
| 27 |
# Perform sentiment analysis when the user clicks the "Classify Sentiment" button
|
| 28 |
+
if st.button("Classify Sentiment"):
|
| 29 |
+
if review is None or review.strip() == '':
|
| 30 |
+
st.warning("Please enter a review.")
|
| 31 |
+
else:
|
| 32 |
+
# Perform sentiment analysis on the input text
|
| 33 |
+
sentiment_result = sentiment_class(review)
|
| 34 |
+
st.write("This review sentiment is ", sentiment_result[1])
|
| 35 |
+
st.write("Prediction score is ", sentiment_result[0])
|
| 36 |
|