SavirD commited on
Commit
e9983ad
1 Parent(s): f7e0570

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -3
app.py CHANGED
@@ -24,6 +24,7 @@ review = st.text_area("", height=150)
24
  inputs = tokenizer.encode(review, return_tensors="pt").to("cpu") # moving to mps for Mac (can alternatively do 'cpu')
25
  logits = model(inputs).logits
26
  predictions = torch.max(logits,1).indices
27
- with st.chat_message("assistant"):
28
- response = "The Following Text " + f'"{review}" is ' + id2label[predictions.tolist()[0]]
29
- st.markdown(response)
 
 
24
  inputs = tokenizer.encode(review, return_tensors="pt").to("cpu") # moving to mps for Mac (can alternatively do 'cpu')
25
  logits = model(inputs).logits
26
  predictions = torch.max(logits,1).indices
27
+ if st.button("Calculate Sentiment"):
28
+ with st.chat_message("assistant"):
29
+ response = "The Following Text " + f'"{review}" is ' + id2label[predictions.tolist()[0]]
30
+ st.markdown(response)