davidaf3 commited on
Commit
09f2656
1 Parent(s): bf8a52d

Fixed paths

Browse files
Files changed (1) hide show
  1. pipeline.py +3 -3
pipeline.py CHANGED
@@ -18,7 +18,7 @@ class PreTrainedPipeline():
18
  hidden_dim = 1024
19
  num_heads = 8
20
  self.nutr_names = ('energy', 'fat', 'protein', 'carbs')
21
- with open(f'ingredients_metadata.json', encoding='UTF-8') as f:
22
  self.ingredients = json.load(f)
23
  self.ing_names = {ing['name']: int(ing_id) for ing_id, ing in self.ingredients.items()}
24
  self.vocab_size = len(self.ingredients) + 3
@@ -35,7 +35,7 @@ class PreTrainedPipeline():
35
  )
36
  self.tfing.compile()
37
  self.tfing((tf.zeros((1, 224, 224, 3)), tf.zeros((1, seq_length))))
38
- self.tfing.load_weights(f'tfing.h5')
39
 
40
  self.tfport = TFPort(
41
  crop_size,
@@ -50,7 +50,7 @@ class PreTrainedPipeline():
50
  )
51
  self.tfport.compile()
52
  self.tfport((tf.zeros((1, 224, 224, 3)), tf.zeros((1, seq_length)), tf.zeros((1, seq_length))))
53
- self.tfport.load_weights(f'/tfport.h5')
54
 
55
  def __call__(self, inputs: "Image.Image") -> List[Dict[str, Any]]:
56
  image = tf.keras.preprocessing.image.img_to_array(inputs)
 
18
  hidden_dim = 1024
19
  num_heads = 8
20
  self.nutr_names = ('energy', 'fat', 'protein', 'carbs')
21
+ with open(os.path.join(path, "ingredients_metadata.json"), encoding='UTF-8') as f:
22
  self.ingredients = json.load(f)
23
  self.ing_names = {ing['name']: int(ing_id) for ing_id, ing in self.ingredients.items()}
24
  self.vocab_size = len(self.ingredients) + 3
 
35
  )
36
  self.tfing.compile()
37
  self.tfing((tf.zeros((1, 224, 224, 3)), tf.zeros((1, seq_length))))
38
+ self.tfing.load_weights(os.path.join(path, 'tfing.h5'))
39
 
40
  self.tfport = TFPort(
41
  crop_size,
 
50
  )
51
  self.tfport.compile()
52
  self.tfport((tf.zeros((1, 224, 224, 3)), tf.zeros((1, seq_length)), tf.zeros((1, seq_length))))
53
+ self.tfport.load_weights(os.path.join(path, 'tfport.h5'))
54
 
55
  def __call__(self, inputs: "Image.Image") -> List[Dict[str, Any]]:
56
  image = tf.keras.preprocessing.image.img_to_array(inputs)