Spaces:
Running
Running
odulcy-mindee
commited on
Upload folder using huggingface_hub
Browse files- backend/pytorch.py +0 -4
- backend/tensorflow.py +0 -4
backend/pytorch.py
CHANGED
@@ -47,7 +47,6 @@ def load_predictor(
|
|
47 |
"""Load a predictor from doctr.models
|
48 |
|
49 |
Args:
|
50 |
-
----
|
51 |
det_arch: detection architecture
|
52 |
reco_arch: recognition architecture
|
53 |
assume_straight_pages: whether to assume straight pages or not
|
@@ -60,7 +59,6 @@ def load_predictor(
|
|
60 |
device: torch.device, the device to load the predictor on
|
61 |
|
62 |
Returns:
|
63 |
-
-------
|
64 |
instance of OCRPredictor
|
65 |
"""
|
66 |
predictor = ocr_predictor(
|
@@ -83,13 +81,11 @@ def forward_image(predictor: OCRPredictor, image: np.ndarray, device: torch.devi
|
|
83 |
"""Forward an image through the predictor
|
84 |
|
85 |
Args:
|
86 |
-
----
|
87 |
predictor: instance of OCRPredictor
|
88 |
image: image to process
|
89 |
device: torch.device, the device to process the image on
|
90 |
|
91 |
Returns:
|
92 |
-
-------
|
93 |
segmentation map
|
94 |
"""
|
95 |
with torch.no_grad():
|
|
|
47 |
"""Load a predictor from doctr.models
|
48 |
|
49 |
Args:
|
|
|
50 |
det_arch: detection architecture
|
51 |
reco_arch: recognition architecture
|
52 |
assume_straight_pages: whether to assume straight pages or not
|
|
|
59 |
device: torch.device, the device to load the predictor on
|
60 |
|
61 |
Returns:
|
|
|
62 |
instance of OCRPredictor
|
63 |
"""
|
64 |
predictor = ocr_predictor(
|
|
|
81 |
"""Forward an image through the predictor
|
82 |
|
83 |
Args:
|
|
|
84 |
predictor: instance of OCRPredictor
|
85 |
image: image to process
|
86 |
device: torch.device, the device to process the image on
|
87 |
|
88 |
Returns:
|
|
|
89 |
segmentation map
|
90 |
"""
|
91 |
with torch.no_grad():
|
backend/tensorflow.py
CHANGED
@@ -46,7 +46,6 @@ def load_predictor(
|
|
46 |
"""Load a predictor from doctr.models
|
47 |
|
48 |
Args:
|
49 |
-
----
|
50 |
det_arch: detection architecture
|
51 |
reco_arch: recognition architecture
|
52 |
assume_straight_pages: whether to assume straight pages or not
|
@@ -59,7 +58,6 @@ def load_predictor(
|
|
59 |
device: tf.device, the device to load the predictor on
|
60 |
|
61 |
Returns:
|
62 |
-
-------
|
63 |
instance of OCRPredictor
|
64 |
"""
|
65 |
with device:
|
@@ -83,13 +81,11 @@ def forward_image(predictor: OCRPredictor, image: np.ndarray, device: tf.device)
|
|
83 |
"""Forward an image through the predictor
|
84 |
|
85 |
Args:
|
86 |
-
----
|
87 |
predictor: instance of OCRPredictor
|
88 |
image: image to process as numpy array
|
89 |
device: tf.device, the device to process the image on
|
90 |
|
91 |
Returns:
|
92 |
-
-------
|
93 |
segmentation map
|
94 |
"""
|
95 |
with device:
|
|
|
46 |
"""Load a predictor from doctr.models
|
47 |
|
48 |
Args:
|
|
|
49 |
det_arch: detection architecture
|
50 |
reco_arch: recognition architecture
|
51 |
assume_straight_pages: whether to assume straight pages or not
|
|
|
58 |
device: tf.device, the device to load the predictor on
|
59 |
|
60 |
Returns:
|
|
|
61 |
instance of OCRPredictor
|
62 |
"""
|
63 |
with device:
|
|
|
81 |
"""Forward an image through the predictor
|
82 |
|
83 |
Args:
|
|
|
84 |
predictor: instance of OCRPredictor
|
85 |
image: image to process as numpy array
|
86 |
device: tf.device, the device to process the image on
|
87 |
|
88 |
Returns:
|
|
|
89 |
segmentation map
|
90 |
"""
|
91 |
with device:
|