feat product 修复
fix
This commit is contained in:
@@ -55,10 +55,7 @@ class GenerateProductImage:
|
|||||||
self.redis_client.set(self.tasks_id, json.dumps(self.gen_product_data))
|
self.redis_client.set(self.tasks_id, json.dumps(self.gen_product_data))
|
||||||
else:
|
else:
|
||||||
# pil图像转成numpy数组
|
# pil图像转成numpy数组
|
||||||
if self.product_type == "single":
|
image = result.as_numpy("generated_inpaint_image")
|
||||||
image = result.as_numpy("generated_inpaint_image")
|
|
||||||
else:
|
|
||||||
image = result.as_numpy("generated_cnet_image")
|
|
||||||
image_result = Image.fromarray(np.squeeze(image.astype(np.uint8))).resize(self.image_size)
|
image_result = Image.fromarray(np.squeeze(image.astype(np.uint8))).resize(self.image_size)
|
||||||
cropped_image = post_processing_image(image_result, self.left, self.top)
|
cropped_image = post_processing_image(image_result, self.left, self.top)
|
||||||
image_url = upload_SDXL_image(cropped_image, user_id=self.user_id, category=f"{self.category}", file_name=f"{self.tasks_id}.png")
|
image_url = upload_SDXL_image(cropped_image, user_id=self.user_id, category=f"{self.category}", file_name=f"{self.tasks_id}.png")
|
||||||
@@ -99,7 +96,6 @@ class GenerateProductImage:
|
|||||||
|
|
||||||
inputs = [input_text, input_image, input_image_strength]
|
inputs = [input_text, input_image, input_image_strength]
|
||||||
|
|
||||||
|
|
||||||
if self.product_type == "single":
|
if self.product_type == "single":
|
||||||
ctx = self.grpc_client.async_infer(model_name="stable_diffusion_xl_cnet_inpaint", inputs=inputs, callback=self.callback)
|
ctx = self.grpc_client.async_infer(model_name="stable_diffusion_xl_cnet_inpaint", inputs=inputs, callback=self.callback)
|
||||||
else:
|
else:
|
||||||
@@ -187,8 +183,8 @@ if __name__ == '__main__':
|
|||||||
# prompt="",
|
# prompt="",
|
||||||
image_strength=0.7,
|
image_strength=0.7,
|
||||||
prompt="The best quality, masterpiece,outwear, 8K realistic, HUD",
|
prompt="The best quality, masterpiece,outwear, 8K realistic, HUD",
|
||||||
image_url="aida-results/result_836dce70-ad59-11ef-86ab-0242ac130002.png",
|
image_url="aida-results/result_53381ada-ac64-11ef-ae9d-0242ac150002.png",
|
||||||
product_type="single"
|
product_type="overall"
|
||||||
)
|
)
|
||||||
server = GenerateProductImage(rd)
|
server = GenerateProductImage(rd)
|
||||||
print(server.get_result())
|
print(server.get_result())
|
||||||
|
|||||||
Reference in New Issue
Block a user