1
0
Fork 0
onnx-web/api/onnx_web/chain/base.py

40 lines
852 B
Python
Raw Permalink Normal View History

2023-11-19 00:13:13 +00:00
from typing import Optional
2023-02-05 13:53:26 +00:00
from PIL import Image
from ..params import ImageParams, Size, SizeChart, StageParams
from ..server.context import ServerContext
from ..worker.context import WorkerContext
2023-11-19 00:13:13 +00:00
from .result import StageResult
2023-01-28 23:09:19 +00:00
class BaseStage:
max_tile = SizeChart.auto
2023-07-01 02:42:24 +00:00
def run(
self,
_worker: WorkerContext,
_server: ServerContext,
_stage: StageParams,
_params: ImageParams,
_sources: StageResult,
2023-12-03 18:53:50 +00:00
*,
stage_source: Optional[Image.Image] = None,
**kwargs,
) -> StageResult:
raise NotImplementedError() # noqa
def steps(
2023-02-05 13:53:26 +00:00
self,
_params: ImageParams,
_size: Size,
) -> int:
return 1 # noqa
def outputs(
self,
_params: ImageParams,
sources: int,
) -> int:
return sources