mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-01-21 20:00:17 +08:00
fix(api-nodes): do not downscale the input image for Topaz Enhance (#11768)
This commit is contained in:
parent
bd0e6825e8
commit
4484b93d61
@ -2,7 +2,6 @@ import builtins
|
|||||||
from io import BytesIO
|
from io import BytesIO
|
||||||
|
|
||||||
import aiohttp
|
import aiohttp
|
||||||
import torch
|
|
||||||
from typing_extensions import override
|
from typing_extensions import override
|
||||||
|
|
||||||
from comfy_api.latest import IO, ComfyExtension, Input
|
from comfy_api.latest import IO, ComfyExtension, Input
|
||||||
@ -138,7 +137,7 @@ class TopazImageEnhance(IO.ComfyNode):
|
|||||||
async def execute(
|
async def execute(
|
||||||
cls,
|
cls,
|
||||||
model: str,
|
model: str,
|
||||||
image: torch.Tensor,
|
image: Input.Image,
|
||||||
prompt: str = "",
|
prompt: str = "",
|
||||||
subject_detection: str = "All",
|
subject_detection: str = "All",
|
||||||
face_enhancement: bool = True,
|
face_enhancement: bool = True,
|
||||||
@ -153,7 +152,9 @@ class TopazImageEnhance(IO.ComfyNode):
|
|||||||
) -> IO.NodeOutput:
|
) -> IO.NodeOutput:
|
||||||
if get_number_of_images(image) != 1:
|
if get_number_of_images(image) != 1:
|
||||||
raise ValueError("Only one input image is supported.")
|
raise ValueError("Only one input image is supported.")
|
||||||
download_url = await upload_images_to_comfyapi(cls, image, max_images=1, mime_type="image/png")
|
download_url = await upload_images_to_comfyapi(
|
||||||
|
cls, image, max_images=1, mime_type="image/png", total_pixels=4096*4096
|
||||||
|
)
|
||||||
initial_response = await sync_op(
|
initial_response = await sync_op(
|
||||||
cls,
|
cls,
|
||||||
ApiEndpoint(path="/proxy/topaz/image/v1/enhance-gen/async", method="POST"),
|
ApiEndpoint(path="/proxy/topaz/image/v1/enhance-gen/async", method="POST"),
|
||||||
|
|||||||
@ -49,6 +49,7 @@ async def upload_images_to_comfyapi(
|
|||||||
mime_type: str | None = None,
|
mime_type: str | None = None,
|
||||||
wait_label: str | None = "Uploading",
|
wait_label: str | None = "Uploading",
|
||||||
show_batch_index: bool = True,
|
show_batch_index: bool = True,
|
||||||
|
total_pixels: int = 2048 * 2048,
|
||||||
) -> list[str]:
|
) -> list[str]:
|
||||||
"""
|
"""
|
||||||
Uploads images to ComfyUI API and returns download URLs.
|
Uploads images to ComfyUI API and returns download URLs.
|
||||||
@ -63,7 +64,7 @@ async def upload_images_to_comfyapi(
|
|||||||
|
|
||||||
for idx in range(num_to_upload):
|
for idx in range(num_to_upload):
|
||||||
tensor = image[idx] if is_batch else image
|
tensor = image[idx] if is_batch else image
|
||||||
img_io = tensor_to_bytesio(tensor, mime_type=mime_type)
|
img_io = tensor_to_bytesio(tensor, total_pixels=total_pixels, mime_type=mime_type)
|
||||||
|
|
||||||
effective_label = wait_label
|
effective_label = wait_label
|
||||||
if wait_label and show_batch_index and num_to_upload > 1:
|
if wait_label and show_batch_index and num_to_upload > 1:
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user