fixed pipeline not working with flask... model was loaded in external process, probably; known issue
This commit is contained in:
parent
7827869af4
commit
0861e22542
@ -1,5 +1,9 @@
|
||||
from funcy import rcompose
|
||||
|
||||
from image_prediction.utils import get_logger
|
||||
|
||||
logger = get_logger()
|
||||
|
||||
|
||||
class PredictionModelHandle:
|
||||
"""Simplifies usage of ModelHandle instances for prediction purposes."""
|
||||
@ -11,4 +15,5 @@ class PredictionModelHandle:
|
||||
return self.__predict(*args, **kwargs)
|
||||
|
||||
def __call__(self, *args, **kwargs):
|
||||
logger.debug("PredictionModelHandle.predict")
|
||||
return self.predict(*args, **kwargs)
|
||||
|
||||
@ -7,6 +7,7 @@ from funcy import retry, compose
|
||||
from waitress import serve
|
||||
|
||||
from image_prediction.flask import make_prediction_server
|
||||
from image_prediction.pipeline import load_pipeline
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@ -36,13 +37,13 @@ def server_type(request):
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def server(server_type, pipeline):
|
||||
def server(server_type):
|
||||
|
||||
if server_type == "dummy":
|
||||
return make_prediction_server(lambda x: int(x.decode()) // 2)
|
||||
|
||||
elif server_type == "actual":
|
||||
return make_prediction_server(compose(list, pipeline))
|
||||
return make_prediction_server(lambda x: list(load_pipeline(verbose=True)(x)))
|
||||
|
||||
else:
|
||||
raise ValueError(f"Unknown server type {server_type}.")
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user