Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -69,7 +69,7 @@ if st.button('Submit'):
|
|
69 |
number = predictions[0].cpu().detach().numpy()
|
70 |
probabilities = torch.nn.functional.softmax(outputs.logits, dim=-1)
|
71 |
|
72 |
-
fig = plt.figure()
|
73 |
ax = fig.add_axes([0,0,1,1])
|
74 |
labels_plot = ['Binnenland', 'Buitenland' ,'Cultuur & Media' ,'Economie' ,'Koningshuis',
|
75 |
'Opmerkelijk' ,'Politiek', 'Regionaal nieuws', 'Tech']
|
@@ -81,7 +81,7 @@ if st.button('Submit'):
|
|
81 |
ax.set_ylabel("Predicted category")
|
82 |
st.pyplot(fig)
|
83 |
|
84 |
-
st.write('The predicted category is: **{}** with a probability of: {:.1f}
|
85 |
# output = genQuestion(option, input)
|
86 |
# print(output)
|
87 |
# st.write(output)
|
|
|
69 |
number = predictions[0].cpu().detach().numpy()
|
70 |
probabilities = torch.nn.functional.softmax(outputs.logits, dim=-1)
|
71 |
|
72 |
+
fig = plt.figure(figsize=(1,1))
|
73 |
ax = fig.add_axes([0,0,1,1])
|
74 |
labels_plot = ['Binnenland', 'Buitenland' ,'Cultuur & Media' ,'Economie' ,'Koningshuis',
|
75 |
'Opmerkelijk' ,'Politiek', 'Regionaal nieuws', 'Tech']
|
|
|
81 |
ax.set_ylabel("Predicted category")
|
82 |
st.pyplot(fig)
|
83 |
|
84 |
+
st.write('The predicted category is: **{}** with a probability of: **{:.1f}%**'.format(labels_plot[number],(probs_plot[predictions])*1))
|
85 |
# output = genQuestion(option, input)
|
86 |
# print(output)
|
87 |
# st.write(output)
|