|
23 | 23 | download_url_to_bytesio, |
24 | 24 | poll_op, |
25 | 25 | sync_op, |
| 26 | + upload_image_to_comfyapi, |
26 | 27 | upload_images_to_comfyapi, |
27 | 28 | validate_string, |
28 | 29 | ) |
@@ -197,7 +198,7 @@ async def execute( |
197 | 198 | if texture_prompt: |
198 | 199 | validate_string(texture_prompt, field_name="texture_prompt", max_length=600) |
199 | 200 | if texture_image is not None: |
200 | | - texture_image_url = (await upload_images_to_comfyapi(cls, texture_image, wait_label="Uploading texture"))[0] |
| 201 | + texture_image_url = await upload_image_to_comfyapi(cls, texture_image, wait_label="Uploading texture") |
201 | 202 | response = await sync_op( |
202 | 203 | cls, |
203 | 204 | endpoint=ApiEndpoint(path="/proxy/meshy/openapi/v2/text-to-3d", method="POST"), |
@@ -344,17 +345,15 @@ async def execute( |
344 | 345 | validate_string(should_texture["texture_prompt"], field_name="texture_prompt", max_length=600) |
345 | 346 | texture_prompt = should_texture["texture_prompt"] |
346 | 347 | if should_texture["texture_image"] is not None: |
347 | | - texture_image_url = ( |
348 | | - await upload_images_to_comfyapi( |
349 | | - cls, should_texture["texture_image"], wait_label="Uploading texture" |
350 | | - ) |
351 | | - )[0] |
| 348 | + texture_image_url = await upload_image_to_comfyapi( |
| 349 | + cls, should_texture["texture_image"], wait_label="Uploading texture" |
| 350 | + ) |
352 | 351 | response = await sync_op( |
353 | 352 | cls, |
354 | 353 | ApiEndpoint(path="/proxy/meshy/openapi/v1/image-to-3d", method="POST"), |
355 | 354 | response_model=MeshyTaskResponse, |
356 | 355 | data=MeshyImageToModelRequest( |
357 | | - image_url=(await upload_images_to_comfyapi(cls, image, wait_label="Uploading base image"))[0], |
| 356 | + image_url=await upload_image_to_comfyapi(cls, image, wait_label="Uploading base image"), |
358 | 357 | ai_model=model, |
359 | 358 | topology=should_remesh.get("topology", None), |
360 | 359 | target_polycount=should_remesh.get("target_polycount", None), |
@@ -505,11 +504,9 @@ async def execute( |
505 | 504 | validate_string(should_texture["texture_prompt"], field_name="texture_prompt", max_length=600) |
506 | 505 | texture_prompt = should_texture["texture_prompt"] |
507 | 506 | if should_texture["texture_image"] is not None: |
508 | | - texture_image_url = ( |
509 | | - await upload_images_to_comfyapi( |
510 | | - cls, should_texture["texture_image"], wait_label="Uploading texture" |
511 | | - ) |
512 | | - )[0] |
| 507 | + texture_image_url = await upload_image_to_comfyapi( |
| 508 | + cls, should_texture["texture_image"], wait_label="Uploading texture" |
| 509 | + ) |
513 | 510 | response = await sync_op( |
514 | 511 | cls, |
515 | 512 | ApiEndpoint(path="/proxy/meshy/openapi/v1/multi-image-to-3d", method="POST"), |
@@ -595,7 +592,7 @@ async def execute( |
595 | 592 | ) -> IO.NodeOutput: |
596 | 593 | texture_image_url = None |
597 | 594 | if texture_image is not None: |
598 | | - texture_image_url = (await upload_images_to_comfyapi(cls, texture_image, wait_label="Uploading texture"))[0] |
| 595 | + texture_image_url = await upload_image_to_comfyapi(cls, texture_image, wait_label="Uploading texture") |
599 | 596 | response = await sync_op( |
600 | 597 | cls, |
601 | 598 | endpoint=ApiEndpoint(path="/proxy/meshy/openapi/v1/rigging", method="POST"), |
@@ -746,7 +743,7 @@ async def execute( |
746 | 743 | raise ValueError("Either text_style_prompt or image_style is required") |
747 | 744 | image_style_url = None |
748 | 745 | if image_style is not None: |
749 | | - image_style_url = (await upload_images_to_comfyapi(cls, image_style, wait_label="Uploading style"))[0] |
| 746 | + image_style_url = await upload_image_to_comfyapi(cls, image_style, wait_label="Uploading style") |
750 | 747 | response = await sync_op( |
751 | 748 | cls, |
752 | 749 | endpoint=ApiEndpoint(path="/proxy/meshy/openapi/v1/retexture", method="POST"), |
|
0 commit comments