Hamda commited on
Commit
ccc474b
1 Parent(s): 8debe46

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -6
app.py CHANGED
@@ -15,8 +15,7 @@ def next_word(text, pipe):
15
  'Word':[],
16
  'Score':[],
17
  }
18
- res=pipe(text)
19
- for e in res:
20
  res_dict['Word'].append(e['token_str'])
21
  res_dict['Score'].append(e['score'])
22
  return res_dict
@@ -25,15 +24,21 @@ st.title("Predict Next Word")
25
  st.write("Expand your query by leveraging various models")
26
  default_value = "التاريخ هو تحليل و"
27
  # sent is the the variable holding the user's input
28
- sent = st.text_area("Text", default_value, height = 30)
29
  sent += ' <mask>'
30
 
31
  pipe = pipeline("fill-mask", tokenizer=tokenizer, model=model)
32
  dict_next_words = next_word(sent, pipe)
33
  df = pd.DataFrame.from_dict(dict_next_words)
34
- #df.reset_index(drop=True, inplace=True)
35
 
 
 
 
 
 
 
 
 
36
 
37
- st.bar_chart(df)
38
- #st.dataframe(df.style.highlight_max(axis=0))
39
  #st.table(df)
 
15
  'Word':[],
16
  'Score':[],
17
  }
18
+ for e in pipe(text):
 
19
  res_dict['Word'].append(e['token_str'])
20
  res_dict['Score'].append(e['score'])
21
  return res_dict
 
24
  st.write("Expand your query by leveraging various models")
25
  default_value = "التاريخ هو تحليل و"
26
  # sent is the the variable holding the user's input
27
+ sent = st.text_area("Text", default_value, height=30)
28
  sent += ' <mask>'
29
 
30
  pipe = pipeline("fill-mask", tokenizer=tokenizer, model=model)
31
  dict_next_words = next_word(sent, pipe)
32
  df = pd.DataFrame.from_dict(dict_next_words)
33
+ df.reset_index(drop=True, inplace=True)
34
 
35
+ chart_data = pd.DataFrame(
36
+ np.random.randn(50, 3),
37
+ columns=["a", "b", "c"])
38
+
39
+ st.bar_chart(chart_data)
40
+ #st.dataframe(df)
41
+
42
+ #st.bar_chart(df)
43
 
 
 
44
  #st.table(df)