EmmaL1 commited on
Commit
812dc31
·
verified ·
1 Parent(s): 1e9a08e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -10
app.py CHANGED
@@ -38,20 +38,12 @@ def textclassification():
38
  st.write(f"Sentiment: {sentiment}")
39
  st.write(f"Confidence: {confidence:.2f}")
40
 
41
- # Determine the rating based on sentiment
42
- if sentiment == "POSITIVE":
43
- rating = 5 # Assign a rating of 5 stars for positive sentiment
44
- elif sentiment == "NEUTRAL":
45
- rating = 3 # Assign a neutral rating of 3 stars
46
- else: # Assuming the other sentiment is "NEGATIVE"
47
- rating = 1 # Assign a rating of 1 star for negative sentiment
48
-
49
  # Display the rating
50
- st.write(f"The rating is {rating} stars")
51
 
52
  # Question Answering
53
  qa_input = {
54
- 'question': f'Why is the rating {rating} star?',
55
  'context': user_input # Use user input as context
56
  }
57
  qa_result = qa_pipeline(qa_input)
 
38
  st.write(f"Sentiment: {sentiment}")
39
  st.write(f"Confidence: {confidence:.2f}")
40
 
 
 
 
 
 
 
 
 
41
  # Display the rating
42
+ st.write(f"The rating is {sentiment} stars")
43
 
44
  # Question Answering
45
  qa_input = {
46
+ 'question': f'Why is the rating {sentiment} star?',
47
  'context': user_input # Use user input as context
48
  }
49
  qa_result = qa_pipeline(qa_input)