rararara9999 commited on
Commit
b6a6fd5
·
verified ·
1 Parent(s): 459f9e5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -5
app.py CHANGED
@@ -15,12 +15,18 @@ def main():
15
 
16
  user_input = st.text_input("")
17
  if user_input:
18
- result = sentiment_pipeline(user_input)
19
- sentiment = result["label"]
20
- confidence = result["score"]
 
 
 
 
21
 
22
- st.write(f"Sentiment: {sentiment}")
23
- st.write(f"Confidence: {confidence:.2f}")
 
 
24
 
25
  if __name__ == "__main__":
26
  main()
 
15
 
16
  user_input = st.text_input("")
17
  if user_input:
18
+ try:
19
+ # Debugging: Print the tokenized input
20
+ st.write("Tokenized Input:", tokenizer(user_input))
21
+
22
+ result = sentiment_pipeline(user_input)
23
+ sentiment = result["label"]
24
+ confidence = result["score"]
25
 
26
+ st.write(f"Sentiment: {sentiment}")
27
+ st.write(f"Confidence: {confidence:.2f}")
28
+ except Exception as e:
29
+ st.write(f"Error: {e}")
30
 
31
  if __name__ == "__main__":
32
  main()