fix
This commit is contained in:
zhouchengrong
2024-07-25 11:21:27 +08:00
parent 9a1b415231
commit 6e007b36cf
2 changed files with 9 additions and 10 deletions

View File

@@ -1,6 +1,5 @@
import concurrent.futures import concurrent.futures
import io import io
from concurrent.futures import ProcessPoolExecutor
import cv2 import cv2
@@ -91,13 +90,13 @@ def process_object(cfg, process_id, total):
else: else:
layers = sorted(layers.layer, key=lambda x: PRIORITY_DICT.get(x['name'], float('inf'))) layers = sorted(layers.layer, key=lambda x: PRIORITY_DICT.get(x['name'], float('inf')))
# 上传所有图片 # 上传所有图片
# for layer in layers: for layer in layers:
# if 'image' in layer.keys() and layer['image'] is not None: if 'image' in layer.keys() and layer['image'] is not None:
# uploaded_images.append({'image_obj': layer['image'], 'image_url': layer['image_url'], 'image_type': 'image'}) uploaded_images.append({'image_obj': layer['image'], 'image_url': layer['image_url'], 'image_type': 'image'})
# if 'pattern_image' in layer.keys() and layer['pattern_image'] is not None: if 'pattern_image' in layer.keys() and layer['pattern_image'] is not None:
# uploaded_images.append({'image_obj': layer['pattern_image'], 'image_url': layer['pattern_image_url'], 'image_type': 'pattern_image'}) uploaded_images.append({'image_obj': layer['pattern_image'], 'image_url': layer['pattern_image_url'], 'image_type': 'pattern_image'})
# if 'mask' in layer.keys() and layer['mask'] is not None and layer['mask_url'] is not None: if 'mask' in layer.keys() and layer['mask'] is not None and layer['mask_url'] is not None:
# uploaded_images.append({'image_obj': layer['mask'], 'image_url': layer['mask_url'], 'image_type': 'mask'}) uploaded_images.append({'image_obj': layer['mask'], 'image_url': layer['mask_url'], 'image_type': 'mask'})
# 合成 # 合成
items_response['synthesis_url'] = synthesis(layers, body_size, basic_info) items_response['synthesis_url'] = synthesis(layers, body_size, basic_info)
@@ -152,7 +151,7 @@ def process_object(cfg, process_id, total):
@RunTime @RunTime
def process_images(images): def process_images(images):
with ProcessPoolExecutor() as executor: with concurrent.futures.ThreadPoolExecutor() as executor:
results = list(executor.map(upload_images, images)) results = list(executor.map(upload_images, images))
# results = [] # results = []
# for image in images: # for image in images:

View File

@@ -46,7 +46,7 @@ from app.service.utils.oss_client import oss_upload_image
# logging.warning(f"upload_png_mask runtime exception : {e}") # logging.warning(f"upload_png_mask runtime exception : {e}")
@RunTime # @RunTime
def upload_png_mask(front_image, object_name, mask=None): def upload_png_mask(front_image, object_name, mask=None):
mask_url = None mask_url = None
if mask is not None: if mask is not None: