Hamda commited on
Commit
68312e7
1 Parent(s): 407249a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -20,7 +20,7 @@ def next_word(text, pipe):
20
 
21
 
22
  for e in pipe(text):
23
- if e['token_str'] not in string.punctuation:
24
  res_dict['Word'].append(e['token_str'])
25
  res_dict['Score'].append(e['score'])
26
  return res_dict
@@ -34,7 +34,7 @@ st.checkbox('استعمال الرسم البياني', value=False)
34
 
35
  text_st = sent+ ' <mask>'
36
 
37
- pipe = pipeline("fill-mask", tokenizer=tokenizer, model=model, top_k=10)
38
  dict_next_words = next_word(text_st, pipe)
39
  df = pd.DataFrame.from_dict(dict_next_words)
40
  df.reset_index(drop=True, inplace=True)
 
20
 
21
 
22
  for e in pipe(text):
23
+ if not any(e['token_str'] in string.punctuation):
24
  res_dict['Word'].append(e['token_str'])
25
  res_dict['Score'].append(e['score'])
26
  return res_dict
 
34
 
35
  text_st = sent+ ' <mask>'
36
 
37
+ pipe = pipeline("fill-mask", tokenizer=tokenizer, model=model, top_k=6)
38
  dict_next_words = next_word(text_st, pipe)
39
  df = pd.DataFrame.from_dict(dict_next_words)
40
  df.reset_index(drop=True, inplace=True)