Update app.py
Browse files
app.py
CHANGED
|
@@ -14,9 +14,8 @@ sent = st.text_area('مدخل',default_value)
|
|
| 14 |
|
| 15 |
tokenizer = AutoTokenizer.from_pretrained("moussaKam/AraBART", max_length=128, padding=True, pad_to_max_length = True, truncation=True)
|
| 16 |
model = AutoModelForMaskedLM.from_pretrained("Hamda/test-1-finetuned-AraBART")
|
| 17 |
-
|
| 18 |
#@st.cache
|
| 19 |
-
|
| 20 |
if (st.button('بحث', disabled=False)):
|
| 21 |
|
| 22 |
def next_word(text, pipe):
|
|
@@ -31,7 +30,6 @@ if (st.button('بحث', disabled=False)):
|
|
| 31 |
return res_dict
|
| 32 |
|
| 33 |
text_st = sent+ ' <mask>'
|
| 34 |
-
pipe = pipeline("fill-mask", tokenizer=tokenizer, model=model, top_k=10)
|
| 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)
|
|
@@ -96,8 +94,16 @@ if (st.checkbox('الاستعانة بالرسم البياني', value=False)):
|
|
| 96 |
break
|
| 97 |
res_df = pd.DataFrame.from_dict(dict_res)
|
| 98 |
res_df.index += 1
|
|
|
|
| 99 |
st.dataframe(res_df)
|
| 100 |
b = time()
|
| 101 |
-
exec_time = (b-a)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 102 |
st.write(f'{str(exec_time)[:2] } :الوقت المستغرق باستعمال الرسم البياني')
|
| 103 |
|
|
|
|
| 14 |
|
| 15 |
tokenizer = AutoTokenizer.from_pretrained("moussaKam/AraBART", max_length=128, padding=True, pad_to_max_length = True, truncation=True)
|
| 16 |
model = AutoModelForMaskedLM.from_pretrained("Hamda/test-1-finetuned-AraBART")
|
| 17 |
+
pipe = pipeline("fill-mask", tokenizer=tokenizer, model=model, top_k=10)
|
| 18 |
#@st.cache
|
|
|
|
| 19 |
if (st.button('بحث', disabled=False)):
|
| 20 |
|
| 21 |
def next_word(text, pipe):
|
|
|
|
| 30 |
return res_dict
|
| 31 |
|
| 32 |
text_st = sent+ ' <mask>'
|
|
|
|
| 33 |
dict_next_words = next_word(text_st, pipe)
|
| 34 |
df = pd.DataFrame.from_dict(dict_next_words)
|
| 35 |
df.reset_index(drop=True, inplace=True)
|
|
|
|
| 94 |
break
|
| 95 |
res_df = pd.DataFrame.from_dict(dict_res)
|
| 96 |
res_df.index += 1
|
| 97 |
+
if (len())
|
| 98 |
st.dataframe(res_df)
|
| 99 |
b = time()
|
| 100 |
+
exec_time = (b-a)
|
| 101 |
+
|
| 102 |
+
text_st = sent+ ' <mask>'
|
| 103 |
+
dict_next_words = next_word(text_st, pipe)
|
| 104 |
+
df = pd.DataFrame.from_dict(dict_next_words)
|
| 105 |
+
df.reset_index(drop=True, inplace=True)
|
| 106 |
+
st.dataframe(df)
|
| 107 |
+
|
| 108 |
st.write(f'{str(exec_time)[:2] } :الوقت المستغرق باستعمال الرسم البياني')
|
| 109 |
|