pedro commited on
Commit
705a53a
·
1 Parent(s): a520ae2
Files changed (1) hide show
  1. handler.py +4 -3
handler.py CHANGED
@@ -4,7 +4,7 @@ import io
4
  import tempfile
5
  from PIL import Image
6
  from pdf2image import convert_from_path
7
-
8
 
9
  def process_image(pdfdata):
10
  prompt = "detect the accident diagram"
@@ -37,14 +37,15 @@ class EndpointHandler:
37
  Args:
38
  path: Path to the model artifacts
39
  """
40
- print("initialized")
41
  pass
42
 
43
  def __call__(self, data: Any) -> List[List[Dict[str, str]]]:
 
44
  inputs = data.pop("inputs", data)
45
  pdfdata = inputs.pop("filedata", inputs)
46
  if isinstance(pdfdata, str):
47
- print("decoding pdfdata")
48
  pdfdata = base64.b64decode(pdfdata)
49
 
50
  return process_image(pdfdata)
 
4
  import tempfile
5
  from PIL import Image
6
  from pdf2image import convert_from_path
7
+ import logging
8
 
9
  def process_image(pdfdata):
10
  prompt = "detect the accident diagram"
 
37
  Args:
38
  path: Path to the model artifacts
39
  """
40
+ logging.warning("initialized")
41
  pass
42
 
43
  def __call__(self, data: Any) -> List[List[Dict[str, str]]]:
44
+ logging.warning("inside __call__")
45
  inputs = data.pop("inputs", data)
46
  pdfdata = inputs.pop("filedata", inputs)
47
  if isinstance(pdfdata, str):
48
+ logging.warning("decoding pdfdata")
49
  pdfdata = base64.b64decode(pdfdata)
50
 
51
  return process_image(pdfdata)