Ryleeeee commited on
Commit
3db428e
·
verified ·
1 Parent(s): 1eb4c51

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -5,7 +5,7 @@ from transformers import pipeline
5
  sentiment_classifier = pipeline("text-classification",model='Ryleeeee/CustomSentimentModel', return_all_scores=True)
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")
@@ -22,12 +22,12 @@ def sentiment_class(text):
22
  max_score = result['score']
23
  max_label = result['label']
24
  return max_score, max_label
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)
 
5
  sentiment_classifier = pipeline("text-classification",model='Ryleeeee/CustomSentimentModel', return_all_scores=True)
6
 
7
  # Streamlit application title and background image
8
+ st.markdown("<div style='text-align:center'><img src='./header.png' width='300' height='200'></div>", unsafe_allow_html=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")
 
22
  max_score = result['score']
23
  max_label = result['label']
24
  return max_score, max_label
25
+
 
26
  # Perform sentiment analysis when the user clicks the "Classify Sentiment" button
27
  if st.button("Classify Sentiment"):
28
+ # Check if the user has entered review
29
  if review is None or review.strip() == '':
30
+ st.warning("Please enter a customer review first.")
31
  else:
32
  # Perform sentiment analysis on the input text
33
  sentiment_result = sentiment_class(review)