Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -7,6 +7,7 @@ import keras
|
|
| 7 |
from huggingface_hub import hf_hub_download
|
| 8 |
from transformers import pipeline
|
| 9 |
import torch
|
|
|
|
| 10 |
|
| 11 |
|
| 12 |
model_name = "Helsinki-NLP/opus-mt-en-hi"
|
|
@@ -27,7 +28,13 @@ model_nmt = TFAutoModelForSeq2SeqLM.from_pretrained(model_checkpoint)
|
|
| 27 |
# Loading models, tokenizer & variables for trained LSTM translation model.
|
| 28 |
repo_id = "Kumarkishalaya/lstm-eng-to-hin"
|
| 29 |
lstm_filename = "seq2seq_model.keras"
|
| 30 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 31 |
|
| 32 |
model_lstm = load_model(lstm_model_path)
|
| 33 |
|
|
|
|
| 7 |
from huggingface_hub import hf_hub_download
|
| 8 |
from transformers import pipeline
|
| 9 |
import torch
|
| 10 |
+
import os
|
| 11 |
|
| 12 |
|
| 13 |
model_name = "Helsinki-NLP/opus-mt-en-hi"
|
|
|
|
| 28 |
# Loading models, tokenizer & variables for trained LSTM translation model.
|
| 29 |
repo_id = "Kumarkishalaya/lstm-eng-to-hin"
|
| 30 |
lstm_filename = "seq2seq_model.keras"
|
| 31 |
+
# Remove the cached file if it exists
|
| 32 |
+
if os.path.exists(lstm_model_path):
|
| 33 |
+
os.remove(lstm_model_path)
|
| 34 |
+
|
| 35 |
+
# Re-download the file
|
| 36 |
+
lstm_model_path = hf_hub_download(repo_id=repo_id, filename=lstm_filename, force_download=True)
|
| 37 |
+
|
| 38 |
|
| 39 |
model_lstm = load_model(lstm_model_path)
|
| 40 |
|