Update app.py
Browse files
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 |
-
|
28 |
-
|
29 |
-
|
|
|
|
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)
|