File size: 582 Bytes
21c571e
933d893
21c571e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#import streamlit as st

#x = st.slider('Select a value')
#st.write(x, 'squared is', x * x)
from transformers import pipeline, BertForQuestionAnswering, AutoTokenizer

modelname = 'models/latin_bert'
model = BertForQuestionAnswering.from_pretrained(modelname)
# Creare un pipeline di riempimento maschere
tokenizer = AutoTokenizer.from_pretrained(modelname)

fill_mask = pipeline("fill-mask", model=model, tokenizer=tokenizer)


# Testare il modello
frase = "Gallia est omnis divisa in [MASK] tres."
output = fill_mask(frase)
for risultato in output:
st.write(risultato["sequence"])