Digambar29 commited on
Commit
40cf0fb
·
1 Parent(s): a95c51f

Fix model path for Docker runtime

Browse files
Files changed (1) hide show
  1. model/inference.py +7 -1
model/inference.py CHANGED
@@ -8,7 +8,13 @@ from PIL import Image
8
  device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
9
 
10
  # load checkpoint
11
- checkpoint = torch.load("emotion_recognition_model.pth", map_location=device)
 
 
 
 
 
 
12
  classes = checkpoint["classes"]
13
 
14
  # recreate model
 
8
  device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
9
 
10
  # load checkpoint
11
+ from pathlib import Path
12
+
13
+ BASE_DIR = Path(__file__).resolve().parent
14
+ MODEL_PATH = BASE_DIR / "emotion_recognition_model.pth"
15
+
16
+ checkpoint = torch.load(MODEL_PATH, map_location=device)
17
+
18
  classes = checkpoint["classes"]
19
 
20
  # recreate model