wiusdy commited on
Commit
80ba3ac
1 Parent(s): 6e61211

solving the logger bug

Browse files
Files changed (1) hide show
  1. inference.py +4 -2
inference.py CHANGED
@@ -8,9 +8,11 @@ class Inference:
8
 
9
  self.deplot_processor = Pix2StructProcessor.from_pretrained('google/deplot')
10
  self.deplot_model = Pix2StructForConditionalGeneration.from_pretrained('google/deplot')
 
 
11
 
12
  def inference(self, selected, image, text):
13
- logger.info(f"selected model {selected}")
14
  if selected == "Model 1":
15
  return self.__inference_deplot(image, text)
16
  elif selected == "Model 2":
@@ -18,7 +20,7 @@ class Inference:
18
  elif selected == "Model 3":
19
  return self.__inference_vilt(image, text)
20
  else:
21
- logger.warning("Please select a model to make the inference..")
22
 
23
  def __inference_vilt(self, image, text):
24
  encoding = self.vilt_processor(image, text, return_tensors="pt")
 
8
 
9
  self.deplot_processor = Pix2StructProcessor.from_pretrained('google/deplot')
10
  self.deplot_model = Pix2StructForConditionalGeneration.from_pretrained('google/deplot')
11
+ logging.set_verbosity_info()
12
+ self.logger = logging.get_logger("transformers")
13
 
14
  def inference(self, selected, image, text):
15
+ self.logger.info(f"selected model {selected}")
16
  if selected == "Model 1":
17
  return self.__inference_deplot(image, text)
18
  elif selected == "Model 2":
 
20
  elif selected == "Model 3":
21
  return self.__inference_vilt(image, text)
22
  else:
23
+ self.logger.warning("Please select a model to make the inference..")
24
 
25
  def __inference_vilt(self, image, text):
26
  encoding = self.vilt_processor(image, text, return_tensors="pt")