Update app.py
Browse files
app.py
CHANGED
@@ -23,20 +23,21 @@ def next_word(text, pipe):
|
|
23 |
st.title("Predict Next Word")
|
24 |
st.write("Expand your query by leveraging various models")
|
25 |
default_value = "التاريخ هو تحليل و"
|
26 |
-
# sent is the
|
27 |
-
sent = st.text_area("
|
28 |
-
sent
|
|
|
|
|
|
|
|
|
29 |
|
30 |
pipe = pipeline("fill-mask", tokenizer=tokenizer, model=model)
|
31 |
-
dict_next_words = next_word(
|
32 |
df = pd.DataFrame.from_dict(dict_next_words)
|
33 |
-
df.reset_index(drop=True, inplace=True)
|
34 |
|
35 |
-
|
36 |
-
|
37 |
-
columns=["a", "b", "c"])
|
38 |
-
|
39 |
-
st.bar_chart(chart_data)
|
40 |
#st.dataframe(df)
|
41 |
|
42 |
#st.bar_chart(df)
|
|
|
23 |
st.title("Predict Next Word")
|
24 |
st.write("Expand your query by leveraging various models")
|
25 |
default_value = "التاريخ هو تحليل و"
|
26 |
+
# sent is the variable holding the user's input
|
27 |
+
sent = st.text_area("Input", default_value, height=30)
|
28 |
+
if len(sent)>20:
|
29 |
+
text_st = sent[-20:]
|
30 |
+
text_st += ' <mask>'
|
31 |
+
else:
|
32 |
+
text_st = sent+ ' <mask>'
|
33 |
|
34 |
pipe = pipeline("fill-mask", tokenizer=tokenizer, model=model)
|
35 |
+
dict_next_words = next_word(text_st, pipe)
|
36 |
df = pd.DataFrame.from_dict(dict_next_words)
|
37 |
+
#df.reset_index(drop=True, inplace=True)
|
38 |
|
39 |
+
st.dataframe(df)
|
40 |
+
st.bar_chart(df)
|
|
|
|
|
|
|
41 |
#st.dataframe(df)
|
42 |
|
43 |
#st.bar_chart(df)
|