Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -24,10 +24,10 @@ import matplotlib.pyplot as plt
|
|
| 24 |
|
| 25 |
from transformers import BertForSequenceClassification, BertTokenizer
|
| 26 |
|
| 27 |
-
model = BertForSequenceClassification.from_pretrained("RuudVelo/
|
| 28 |
#from transformers import BertTokenizer
|
| 29 |
|
| 30 |
-
tokenizer = BertTokenizer.from_pretrained("RuudVelo/
|
| 31 |
|
| 32 |
#text = ["this is one sentence", "this is another sentence"]
|
| 33 |
text = st.text_area('Please type/copy/paste the Dutch article')
|
|
@@ -40,12 +40,13 @@ if text:
|
|
| 40 |
|
| 41 |
fig = plt.figure()
|
| 42 |
ax = fig.add_axes([0,0,1,1])
|
| 43 |
-
|
| 44 |
'Opmerkelijk' ,'Politiek', 'Regionaal nieuws', 'Tech']
|
| 45 |
-
|
| 46 |
|
| 47 |
-
ax.barh(
|
| 48 |
st.pyplot(fig)
|
|
|
|
| 49 |
#plt.show()
|
| 50 |
#out = pipe(text)
|
| 51 |
#st.json(predictions)
|
|
|
|
| 24 |
|
| 25 |
from transformers import BertForSequenceClassification, BertTokenizer
|
| 26 |
|
| 27 |
+
model = BertForSequenceClassification.from_pretrained("RuudVelo/dutch_news_clf_bert_finetuned")
|
| 28 |
#from transformers import BertTokenizer
|
| 29 |
|
| 30 |
+
tokenizer = BertTokenizer.from_pretrained("RuudVelo/dutch_news_clf_bert_finetuned")
|
| 31 |
|
| 32 |
#text = ["this is one sentence", "this is another sentence"]
|
| 33 |
text = st.text_area('Please type/copy/paste the Dutch article')
|
|
|
|
| 40 |
|
| 41 |
fig = plt.figure()
|
| 42 |
ax = fig.add_axes([0,0,1,1])
|
| 43 |
+
labels_plot = ['Binnenland', 'Buitenland' ,'Cultuur & Media' ,'Economie' ,'Koningshuis',
|
| 44 |
'Opmerkelijk' ,'Politiek', 'Regionaal nieuws', 'Tech']
|
| 45 |
+
probs_plot = probabilities[0].cpu().detach().numpy()
|
| 46 |
|
| 47 |
+
ax.barh(labels_plot,probs_plot )
|
| 48 |
st.pyplot(fig)
|
| 49 |
+
st.json(predictions)
|
| 50 |
#plt.show()
|
| 51 |
#out = pipe(text)
|
| 52 |
#st.json(predictions)
|