EmmaL1 commited on
Commit
7996a2e
·
verified ·
1 Parent(s): 1a10e36

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -1
app.py CHANGED
@@ -58,4 +58,20 @@ def textclassification():
58
  # Calculate rating using improved function
59
  rating = calculate_rating(sentiment, confidence)
60
 
61
- # Display the ra
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
58
  # Calculate rating using improved function
59
  rating = calculate_rating(sentiment, confidence)
60
 
61
+ # Display the rating with stars visual
62
+ stars = "⭐" * rating + "☆" *
63
+ st.markdown(f"### Predicted Rating: {stars} ({rating}/5)")
64
+
65
+ # Question Answering
66
+ qa_input = {
67
+ 'question': f'Why would this review get {rating} stars?',
68
+ 'context': user_input
69
+ }
70
+ qa_result = qa_pipeline(qa_input)
71
+ st.write(f"**Key Reasons:** {qa_result['answer']}")
72
+
73
+ def main():
74
+ textclassification()
75
+
76
+ if __name__ == "__main__":
77
+ main()