Skip to content

Commit

Permalink
passing tests locally
Browse files Browse the repository at this point in the history
  • Loading branch information
yCobanoglu committed Nov 16, 2023
1 parent 0196dd2 commit a9db755
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 6 deletions.
1 change: 1 addition & 0 deletions ebl_ai/generate_bounding_boxes_resource.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import falcon
import numpy as np
from PIL import Image

Image.MAX_IMAGE_PIXELS = None

from ebl_ai.model import Model
Expand Down
2 changes: 0 additions & 2 deletions ebl_ai/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ class Model:
def __init__(self, configFile: str, checkpoint: str):
self.model = MMOCRInferencer(det=configFile, det_weights=checkpoint)


def _predict(self, image_path: str) -> List[List[float]]:
x = self.model(image_path)["predictions"]
result = []
Expand Down Expand Up @@ -72,4 +71,3 @@ def predict(
boundary_results = self._predict(file.name)

return self._polygons_with_probabilites_to_rectangle(boundary_results)

5 changes: 1 addition & 4 deletions ebl_ai/tests/test_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
TEST_IMAGE_PATH = "ebl_ai/tests/test_image.jpg"


#@pytest.mark.skip(reason="Takes very long")
def test_model_predictions():
model = Model(configFile=CONFIG_FILE, checkpoint=CHECKPOINT)

Expand All @@ -21,9 +20,7 @@ def test_model_predictions():
assert isinstance(predictions[0], BoundingBoxesPrediction)
assert len(predictions) > 1

model.show_result(TEST_IMAGE_PATH, "./test_image_prediction.jpg", False)

img = Image.open(TEST_IMAGE_PATH)
predictions = model.predict(np.asarray(img))
predictions = model.model(np.asarray(img), show=True)
assert isinstance(predictions[0], BoundingBoxesPrediction)
assert len(predictions) > 1

0 comments on commit a9db755

Please sign in to comment.