IinjyI commited on
Commit
068ce9c
·
verified ·
1 Parent(s): 6826d47

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -4
app.py CHANGED
@@ -20,13 +20,15 @@ nltk.download('stopwords')
20
 
21
  model_checkpoint = "marefa-nlp/marefa-mt-en-ar"
22
  tokenizer = AutoTokenizer.from_pretrained(model_checkpoint)
23
- #model = TFAutoModelForSeq2SeqLM.from_pretrained(model_checkpoint,from_pt=True)
24
- with zipfile.ZipFile("tf_model.zip", 'r') as zip_ref:
25
- zip_ref.extractall("./marian_model/")
26
 
27
- model = TFAutoModelForSeq2SeqLM.from_pretrained("./marian_model/")
 
28
 
 
 
29
 
 
 
30
 
31
  # Load cleaned_word_embeddings
32
  with open("cleaned_word_embeddings.pkl", "rb") as f:
 
20
 
21
  model_checkpoint = "marefa-nlp/marefa-mt-en-ar"
22
  tokenizer = AutoTokenizer.from_pretrained(model_checkpoint)
 
 
 
23
 
24
+ with zipfile.ZipFile("model.zip", 'r') as zip_ref:
25
+ zip_ref.extractall("./marian_model/")
26
 
27
+ # Define the model architecture
28
+ model = TFAutoModelForSeq2SeqLM.from_pretrained(model_checkpoint, from_pt=True)
29
 
30
+ # Load the weights from the .h5 file
31
+ model.load_weights("./marian_model/model.weights.h5")
32
 
33
  # Load cleaned_word_embeddings
34
  with open("cleaned_word_embeddings.pkl", "rb") as f: