Update app.py
Browse files
app.py
CHANGED
@@ -16,9 +16,7 @@ tokenizer = AutoTokenizer.from_pretrained("moussaKam/AraBART", max_length=128, p
|
|
16 |
model = AutoModelForMaskedLM.from_pretrained("Hamda/test-1-finetuned-AraBART")
|
17 |
pipe = pipeline("fill-mask", tokenizer=tokenizer, model=model, top_k=10)
|
18 |
#@st.cache
|
19 |
-
|
20 |
-
|
21 |
-
def next_word(text, pipe):
|
22 |
res_dict= {
|
23 |
'الكلمة المقترحة':[],
|
24 |
'العلامة':[],
|
@@ -28,7 +26,7 @@ if (st.button('بحث', disabled=False)):
|
|
28 |
res_dict['الكلمة المقترحة'].append(e['token_str'])
|
29 |
res_dict['العلامة'].append(e['score'])
|
30 |
return res_dict
|
31 |
-
|
32 |
text_st = sent+ ' <mask>'
|
33 |
dict_next_words = next_word(text_st, pipe)
|
34 |
df = pd.DataFrame.from_dict(dict_next_words)
|
|
|
16 |
model = AutoModelForMaskedLM.from_pretrained("Hamda/test-1-finetuned-AraBART")
|
17 |
pipe = pipeline("fill-mask", tokenizer=tokenizer, model=model, top_k=10)
|
18 |
#@st.cache
|
19 |
+
def next_word(text, pipe):
|
|
|
|
|
20 |
res_dict= {
|
21 |
'الكلمة المقترحة':[],
|
22 |
'العلامة':[],
|
|
|
26 |
res_dict['الكلمة المقترحة'].append(e['token_str'])
|
27 |
res_dict['العلامة'].append(e['score'])
|
28 |
return res_dict
|
29 |
+
if (st.button('بحث', disabled=False)):
|
30 |
text_st = sent+ ' <mask>'
|
31 |
dict_next_words = next_word(text_st, pipe)
|
32 |
df = pd.DataFrame.from_dict(dict_next_words)
|