Update app.py
Browse files
app.py
CHANGED
@@ -24,14 +24,12 @@ model = AutoModelForMaskedLM.from_pretrained("Hamda/test-1-finetuned-AraBART")
|
|
24 |
pipe = pipeline("fill-mask", tokenizer=tokenizer, model=model, top_k=10)
|
25 |
|
26 |
def next_word(text, pipe):
|
27 |
-
|
28 |
-
filter_words = list(string.punctuation).extend(sent)
|
29 |
res_dict= {
|
30 |
'الكلمة المقترحة':[],
|
31 |
'العلامة':[],
|
32 |
}
|
33 |
for e in pipe(text):
|
34 |
-
if all(c not in
|
35 |
res_dict['الكلمة المقترحة'].append(e['token_str'])
|
36 |
res_dict['العلامة'].append(e['score'])
|
37 |
return res_dict
|
|
|
24 |
pipe = pipeline("fill-mask", tokenizer=tokenizer, model=model, top_k=10)
|
25 |
|
26 |
def next_word(text, pipe):
|
|
|
|
|
27 |
res_dict= {
|
28 |
'الكلمة المقترحة':[],
|
29 |
'العلامة':[],
|
30 |
}
|
31 |
for e in pipe(text):
|
32 |
+
if all(c not in list(string.punctuation) for c in e['token_str']):
|
33 |
res_dict['الكلمة المقترحة'].append(e['token_str'])
|
34 |
res_dict['العلامة'].append(e['score'])
|
35 |
return res_dict
|