feat 代码整理
fix
This commit is contained in:
61
app/service/design_fast/item.py
Normal file
61
app/service/design_fast/item.py
Normal file
@@ -0,0 +1,61 @@
|
||||
from app.service.design_fast.pipeline import LoadImage, KeyPoint, Segmentation, Color, PrintPainting, Scaling, Split, LoadBodyImage, ContourDetection
|
||||
|
||||
|
||||
class BaseItem:
|
||||
def __init__(self, data, basic):
|
||||
self.result = data.copy()
|
||||
self.result['name'] = data['type'].lower()
|
||||
self.result.pop("type")
|
||||
self.result.update(basic)
|
||||
|
||||
|
||||
class TopItem(BaseItem):
|
||||
def __init__(self, data, basic, minio_client):
|
||||
super().__init__(data, basic)
|
||||
self.top_pipeline = [
|
||||
LoadImage(minio_client),
|
||||
KeyPoint(),
|
||||
Segmentation(minio_client),
|
||||
Color(minio_client),
|
||||
PrintPainting(minio_client),
|
||||
Scaling(),
|
||||
Split(minio_client)
|
||||
]
|
||||
|
||||
def process(self):
|
||||
for item in self.top_pipeline:
|
||||
self.result = item(self.result)
|
||||
return self.result
|
||||
|
||||
|
||||
class BottomItem(BaseItem):
|
||||
def __init__(self, data, basic, minio_client):
|
||||
super().__init__(data, basic)
|
||||
self.bottom_pipeline = [
|
||||
LoadImage(minio_client),
|
||||
KeyPoint(),
|
||||
ContourDetection(),
|
||||
# Segmentation(),
|
||||
Color(minio_client),
|
||||
PrintPainting(minio_client),
|
||||
Scaling(),
|
||||
Split(minio_client)
|
||||
]
|
||||
|
||||
def process(self):
|
||||
for item in self.bottom_pipeline:
|
||||
self.result = item(self.result)
|
||||
return self.result
|
||||
|
||||
|
||||
class BodyItem(BaseItem):
|
||||
def __init__(self, data, basic, minio_client):
|
||||
super().__init__(data, basic)
|
||||
self.top_pipeline = [
|
||||
LoadBodyImage(minio_client),
|
||||
]
|
||||
|
||||
def process(self):
|
||||
for item in self.top_pipeline:
|
||||
self.result = item(self.result)
|
||||
return self.result
|
||||
Reference in New Issue
Block a user