Spaces:
Sleeping
Sleeping
init change latin bert
Browse files
app.py
CHANGED
@@ -1,4 +1,19 @@
|
|
1 |
-
import streamlit as st
|
2 |
|
3 |
-
x = st.slider('Select a value')
|
4 |
-
st.write(x, 'squared is', x * x)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#import streamlit as st
|
2 |
|
3 |
+
#x = st.slider('Select a value')
|
4 |
+
#st.write(x, 'squared is', x * x)
|
5 |
+
from transformers import pipeline, BertForQuestionAnswering, AutoTokenizer
|
6 |
+
|
7 |
+
modelname = 'models/latin_bert'
|
8 |
+
model = BertForQuestionAnswering.from_pretrained(modelname)
|
9 |
+
# Creare un pipeline di riempimento maschere
|
10 |
+
tokenizer = AutoTokenizer.from_pretrained(modelname)
|
11 |
+
|
12 |
+
fill_mask = pipeline("fill-mask", model=model, tokenizer=tokenizer)
|
13 |
+
|
14 |
+
|
15 |
+
# Testare il modello
|
16 |
+
frase = "Gallia est omnis divisa in [MASK] tres."
|
17 |
+
output = fill_mask(frase)
|
18 |
+
for risultato in output:
|
19 |
+
st.write(risultato["sequence"])
|