Hamda commited on
Commit
286e8f3
·
1 Parent(s): 5f8bbd6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -6
app.py CHANGED
@@ -19,13 +19,13 @@ model = AutoModelForMaskedLM.from_pretrained("Hamda/test-1-finetuned-AraBART")
19
  if (st.button('بحث', disabled=False)):
20
  def next_word(text, pipe):
21
  res_dict= {
22
- 'Word':[],
23
- 'Score':[],
24
  }
25
  for e in pipe(text):
26
  if all(c not in list(string.punctuation) for c in e['token_str']):
27
- res_dict['Word'].append(e['token_str'])
28
- res_dict['Score'].append(e['score'])
29
  return res_dict
30
 
31
  text_st = sent+ ' <mask>'
@@ -79,8 +79,8 @@ if (st.button('استعمال الرسم البياني', disabled=False)):
79
  dict_res = {'word':[], 'score':[]}
80
  for key, value in tmexp:
81
  new_score=((value-min(t_li))/(max(t_li)-min(t_li)))-0.0001
82
- dict_res['score'].append(str(new_score)[:6])
83
- dict_res['word'].append(key)
84
  i+=1
85
  if (i==10):
86
  break
 
19
  if (st.button('بحث', disabled=False)):
20
  def next_word(text, pipe):
21
  res_dict= {
22
+ 'الكلمة المقترحة':[],
23
+ 'العلامة':[],
24
  }
25
  for e in pipe(text):
26
  if all(c not in list(string.punctuation) for c in e['token_str']):
27
+ res_dict['الكلمة المقترحة'].append(e['token_str'])
28
+ res_dict['العلامة'].append(e['score'])
29
  return res_dict
30
 
31
  text_st = sent+ ' <mask>'
 
79
  dict_res = {'word':[], 'score':[]}
80
  for key, value in tmexp:
81
  new_score=((value-min(t_li))/(max(t_li)-min(t_li)))-0.0001
82
+ dict_res['العلامة'].append(str(new_score)[:6])
83
+ dict_res['الكلمة المقترحة'].append(key)
84
  i+=1
85
  if (i==10):
86
  break