Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -65,6 +65,7 @@ if st.button('Submit'):
|
|
65 |
encoding = tokenizer(text, return_tensors="pt")
|
66 |
outputs = model(**encoding)
|
67 |
predictions = outputs.logits.argmax(-1)
|
|
|
68 |
probabilities = torch.nn.functional.softmax(outputs.logits, dim=-1)
|
69 |
|
70 |
fig = plt.figure()
|
@@ -79,7 +80,7 @@ if st.button('Submit'):
|
|
79 |
ax.set_ylabel("Predicted category")
|
80 |
st.pyplot(fig)
|
81 |
|
82 |
-
st.write('Category: {} | Probability: {:.1f}%'.format(
|
83 |
# output = genQuestion(option, input)
|
84 |
# print(output)
|
85 |
# st.write(output)
|
|
|
65 |
encoding = tokenizer(text, return_tensors="pt")
|
66 |
outputs = model(**encoding)
|
67 |
predictions = outputs.logits.argmax(-1)
|
68 |
+
number = predictions.cpu().detach().numpy().astype(int)
|
69 |
probabilities = torch.nn.functional.softmax(outputs.logits, dim=-1)
|
70 |
|
71 |
fig = plt.figure()
|
|
|
80 |
ax.set_ylabel("Predicted category")
|
81 |
st.pyplot(fig)
|
82 |
|
83 |
+
st.write('Category: {} | Probability: {:.1f}%'.format(number,(probs_plot[predictions])))
|
84 |
# output = genQuestion(option, input)
|
85 |
# print(output)
|
86 |
# st.write(output)
|