class_docstr: The predictor class handles prediction, given an input model.
  
  Loads the images in the input directory, executes training given a model
  and saves the results in the output directory.
  Can receive a path for the weights or can let the user browse through the
  weights directory for the desired weights.
  
  Args:
      input_dir: string, path to the input directory.
      output_dir: string, path to the output directory.
      verbose: bool.
  
  Attributes:
      extensions: list of accepted image extensions.
      img_ls: list of image files in input_dir.
  
  Methods:
      get_predictions: given a model and a string containing the weights' path,
          runs the predictions on the images contained in the input directory and
          stores the results in the output directory.
class_docstr_tok: ["The","predictor","class","handles","prediction",",","given","an","input","model",".","Loads","the","images","in","the","input","directory",",","executes","training","given","a","model","and","saves","the","results","in","the","output","directory",".","Can","receive","a","path","for","the","weights","or","can","let","the","user","browse","through","the","weights","directory","for","the","desired","weights",".","Args",":","input_dir",":","string",",","path","to","the","input","directory",".","output_dir",":","string",",","path","to","the","output","directory",".","verbose",":","bool",".","Attributes",":","extensions",":","list","of","accepted","image","extensions",".","img_ls",":","list","of","image","files","in","input_dir",".","Methods",":","get_predictions",":","given","a","model","and","a","string","containing","the","weights","'","path",",","runs","the","predictions","on","the","images","contained","in","the","input","directory","and","stores","the","results","in","the","output","directory","."]
docstr: Runs the prediction. 
docstr_tok: ["Runs","the","prediction","."]
code: def get_predictions(self, model, weights_path):
      """Runs the prediction."""
  
      self.model = model
      self.weights_path = Path(weights_path)
      weights_conf = self._load_weights()
      out_folder = (
          self.output_dir / self._make_basename() / get_timestamp()
      )
      self.logger.info("Results in:\n > {}".format(out_folder))
      if out_folder.exists():
          self.logger.warning("Directory exists, might overwrite files")
      else:
          out_folder.mkdir(parents=True)
      if weights_conf:
          yaml.dump(
              weights_conf,
              (out_folder / "weights_config.yml").open("w"),
          )
      # Predict and store
      for img_path in self.img_ls:
          output_path = out_folder / img_path.name
          self.logger.info("Processing file\n > {}".format(img_path))
          start = time()
          sr_img = self._forward_pass(img_path)
          end = time()
          self.logger.info("Elapsed time: {}s".format(end - start))
          self.logger.info("Result in: {}".format(output_path))
          imageio.imwrite(output_path, sr_img)
  
file_path: image-super-resolution/ISR/predict/predictor.py
imports: from time import time
  import imageio
  import yaml
  import numpy
  from pathlib import Path
  from ISR.utils.logger import get_logger
  from ISR.utils.utils import get_timestamp
label_desc: Use image node_id 4 for calling the Predictor obj's underlying member method code with example usage: obj.get_predictions(model, weights_path) without return types