SCANSKY commited on
Commit
24bacd6
·
verified ·
1 Parent(s): 55e2d91

Update handler.py

Browse files
Files changed (1) hide show
  1. handler.py +7 -1
handler.py CHANGED
@@ -2,9 +2,15 @@ from transformers import pipeline
2
  from sklearn.preprocessing import LabelEncoder
3
  import joblib
4
  import torch
 
5
 
6
  # Load the label encoder
7
- label_encoder = joblib.load('label_encoder.pkl')
 
 
 
 
 
8
 
9
  # Load the model and tokenizer from Hugging Face
10
  model_name = "SCANSKY/distilbertTourism-multilingual-sentiment"
 
2
  from sklearn.preprocessing import LabelEncoder
3
  import joblib
4
  import torch
5
+ import os
6
 
7
  # Load the label encoder
8
+
9
+ try:
10
+ label_encoder = joblib.load('/repository/label_encoder.pkl')
11
+
12
+ except error:
13
+ print("COULD NOT FIND LABEL_ENCODER. HERE'S THE CWD -->"+string(os.getcwd()))
14
 
15
  # Load the model and tokenizer from Hugging Face
16
  model_name = "SCANSKY/distilbertTourism-multilingual-sentiment"