nguyenp99 commited on
Commit
adc3ff1
1 Parent(s): 0f18a0c

Update stamp_processing/remover.py

Browse files
Files changed (1) hide show
  1. stamp_processing/remover.py +6 -6
stamp_processing/remover.py CHANGED
@@ -7,7 +7,7 @@ import numpy.typing as npt
7
  from .detector import StampDetector
8
  from .module.unet import *
9
  from .preprocess import create_batch
10
- from .utils import REMOVER_WEIGHT_ID, check_image_shape, download_weight, logger
11
 
12
 
13
  class StampRemover:
@@ -23,16 +23,16 @@ class StampRemover:
23
  os.makedirs("tmp/", exist_ok=True)
24
  removal_weight = os.path.join("tmp", "stamp_remover.pkl")
25
 
26
- logger.info("Downloading stamp remover weight from google drive")
27
  download_weight(REMOVER_WEIGHT_ID, output=removal_weight)
28
- logger.info(f"Finished downloading. Weight is saved at {removal_weight}")
29
 
30
  try:
31
  self.remover = UnetInference(removal_weight) # type: ignore
32
  except Exception as e:
33
- logger.error(e)
34
- logger.error("There is something wrong when loading remover weight")
35
- logger.error(
36
  "Please make sure you provide the correct path to the weight"
37
  "or mannually download the weight at"
38
  f"https://drive.google.com/file/d/{REMOVER_WEIGHT_ID}/view?usp=sharing"
 
7
  from .detector import StampDetector
8
  from .module.unet import *
9
  from .preprocess import create_batch
10
+ from .utils import REMOVER_WEIGHT_ID, check_image_shape, download_weight
11
 
12
 
13
  class StampRemover:
 
23
  os.makedirs("tmp/", exist_ok=True)
24
  removal_weight = os.path.join("tmp", "stamp_remover.pkl")
25
 
26
+ print("Downloading stamp remover weight from google drive")
27
  download_weight(REMOVER_WEIGHT_ID, output=removal_weight)
28
+ print(f"Finished downloading. Weight is saved at {removal_weight}")
29
 
30
  try:
31
  self.remover = UnetInference(removal_weight) # type: ignore
32
  except Exception as e:
33
+ print(e)
34
+ print("There is something wrong when loading remover weight")
35
+ print(
36
  "Please make sure you provide the correct path to the weight"
37
  "or mannually download the weight at"
38
  f"https://drive.google.com/file/d/{REMOVER_WEIGHT_ID}/view?usp=sharing"