dancingninjas commited on
Commit
c06f677
·
1 Parent(s): 7864f6f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -2
app.py CHANGED
@@ -8,5 +8,11 @@ pipe=pipeline(model="dancingninjas/sentiment-model")
8
  text=st.text_area('Enter your text')
9
 
10
  if text:
11
- out=pipe(text)
12
- st.table(out)
 
 
 
 
 
 
 
8
  text=st.text_area('Enter your text')
9
 
10
  if text:
11
+ out = pipe(text)
12
+
13
+ # Convert the model's output (0 or 1) to descriptive labels
14
+ sentiment_label = "Positive" if out[0]['label'] == 'LABEL_1' else "Negative"
15
+
16
+ # Display the sentiment label and probability
17
+ st.write(f'Sentiment: {sentiment_label}')
18
+ st.write(f'Probability: {out[0]["score"]:.4f}')