Update app.py
Browse files
app.py
CHANGED
@@ -58,7 +58,13 @@ class LuongAttention(tf.keras.layers.Layer):
|
|
58 |
model_path = hf_hub_download(repo_id="logasanjeev/sentiment-analysis-bilstm-luong", filename="sentiment_model.h5")
|
59 |
tokenizer_path = hf_hub_download(repo_id="logasanjeev/sentiment-analysis-bilstm-luong", filename="tokenizer.pkl")
|
60 |
encoder_path = hf_hub_download(repo_id="logasanjeev/sentiment-analysis-bilstm-luong", filename="label_encoder.pkl")
|
61 |
-
model = load_model(
|
|
|
|
|
|
|
|
|
|
|
|
|
62 |
with open(tokenizer_path, "rb") as f:
|
63 |
tokenizer = pickle.load(f)
|
64 |
with open(encoder_path, "rb") as f:
|
|
|
58 |
model_path = hf_hub_download(repo_id="logasanjeev/sentiment-analysis-bilstm-luong", filename="sentiment_model.h5")
|
59 |
tokenizer_path = hf_hub_download(repo_id="logasanjeev/sentiment-analysis-bilstm-luong", filename="tokenizer.pkl")
|
60 |
encoder_path = hf_hub_download(repo_id="logasanjeev/sentiment-analysis-bilstm-luong", filename="label_encoder.pkl")
|
61 |
+
model = load_model(
|
62 |
+
model_path,
|
63 |
+
custom_objects={
|
64 |
+
"LuongAttention": LuongAttention,
|
65 |
+
"focal_loss_fn": lambda y_true, y_pred: y_true # Placeholder for custom loss
|
66 |
+
}
|
67 |
+
)
|
68 |
with open(tokenizer_path, "rb") as f:
|
69 |
tokenizer = pickle.load(f)
|
70 |
with open(encoder_path, "rb") as f:
|