Hamda commited on
Commit
7a14486
1 Parent(s): 4bb560b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -6,9 +6,9 @@ import pandas as pd
6
  import numpy as np
7
  import string
8
 
9
-
10
  tokenizer = AutoTokenizer.from_pretrained("moussaKam/AraBART", max_length=128, padding=True, pad_to_max_length = True, truncation=True)
11
- model = AutoModelForMaskedLM.from_pretrained("Hamda/test-1-finetuned-AraBART")
12
 
13
  #@st.cache
14
  def next_word(text, pipe):
@@ -31,7 +31,7 @@ st.checkbox('استعمال الرسم البياني', value=False)
31
 
32
  text_st = sent+ ' <mask>'
33
 
34
- pipe = pipeline("fill-mask", tokenizer=tokenizer, model=model, top_k=6)
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)
 
6
  import numpy as np
7
  import string
8
 
9
+ device = 'cuda'
10
  tokenizer = AutoTokenizer.from_pretrained("moussaKam/AraBART", max_length=128, padding=True, pad_to_max_length = True, truncation=True)
11
+ model = AutoModelForMaskedLM.from_pretrained("Hamda/test-1-finetuned-AraBART").to(device)
12
 
13
  #@st.cache
14
  def next_word(text, pipe):
 
31
 
32
  text_st = sent+ ' <mask>'
33
 
34
+ pipe = pipeline("fill-mask", tokenizer=tokenizer, model=model, top_k=15)
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)