k23064919 commited on
Commit
27a811d
·
1 Parent(s): e346658
Files changed (1) hide show
  1. ui/utils.py +6 -1
ui/utils.py CHANGED
@@ -6,17 +6,22 @@ import torch
6
  import numpy as np
7
  from PIL import Image
8
  import torchvision.transforms as transforms
 
9
 
10
  IMAGE_SIZE = (256, 256)
11
 
12
  NORMALIZE_MEAN = [0.485, 0.456, 0.406]
13
  NORMALIZE_STD = [0.229, 0.224, 0.225]
14
 
15
- CLASS_NAMES_FILE = "classNames.txt"
16
  TOP_K_PREDICTIONS = 5
17
  CONFIDENCE_THRESHOLD = 0.01
18
 
19
 
 
 
 
 
 
20
  with open(CLASS_NAMES_FILE, "r") as f:
21
  CLASS_NAMES = [line.strip() for line in f.readlines() if line.strip()]
22
 
 
6
  import numpy as np
7
  from PIL import Image
8
  import torchvision.transforms as transforms
9
+ import os
10
 
11
  IMAGE_SIZE = (256, 256)
12
 
13
  NORMALIZE_MEAN = [0.485, 0.456, 0.406]
14
  NORMALIZE_STD = [0.229, 0.224, 0.225]
15
 
 
16
  TOP_K_PREDICTIONS = 5
17
  CONFIDENCE_THRESHOLD = 0.01
18
 
19
 
20
+ BASE_DIR = os.path.dirname(os.path.abspath(__file__))
21
+
22
+ # Path to classNames.txt relative to this file
23
+ CLASS_NAMES_FILE = os.path.join(BASE_DIR, "classNames.txt")
24
+
25
  with open(CLASS_NAMES_FILE, "r") as f:
26
  CLASS_NAMES = [line.strip() for line in f.readlines() if line.strip()]
27