Update app.py
Browse files
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 |
-
|
|
|
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:
|