Remove URL output; return only image tensor

This commit is contained in:
RITIK
2025-11-26 14:18:21 +05:30
parent 0d7bb11054
commit a9aef31f67
2 changed files with 16 additions and 12 deletions
+2 -2
View File
@@ -36,12 +36,12 @@ Repo layout (mirrors Floyo Seed API style):
### FLUX.2 [pro] Text-to-Image (`Flux2ProTextToImage`)
- **Inputs (required):** `prompt`, `width`, `height`
- **Inputs (optional):** `seed` (`-1` = random), `safety_tolerance` (0-6), `output_format` (`jpeg`/`png`)
- **Outputs:** `image_url` (STRING, signed URL valid for ~10 minutes), `image` (IMAGE tensor ready for Save Image)
- **Output:** `image` (IMAGE tensor ready for Save Image)
### FLUX.2 [pro] Image Edit (`Flux2ProImageEdit`)
- **Inputs (required):** `prompt`, `input_image` (IMAGE tensor) or `input_image_url` (URL). If both are set, URL wins.
- **Inputs (optional):** `input_image_2` … `input_image_8` (IMAGE tensors) and matching `input_image_2_url` … `input_image_8_url`. URLs win over tensors. Keep total refs <= 8. `width`, `height` (0 = match input), `seed` (`-1` = random), `safety_tolerance`, `output_format`
- **Outputs:** `image_url` (STRING, signed URL valid for ~10 minutes), `image` (IMAGE tensor ready for Save Image)
- **Output:** `image` (IMAGE tensor ready for Save Image)
## Usage Notes
- The returned URL expires quickly; run your Floyo download/output node immediately after this node.
+14 -10
View File
@@ -43,8 +43,8 @@ class Flux2ProTextToImage:
},
}
RETURN_TYPES = ("STRING", "IMAGE")
RETURN_NAMES = ("image_url", "image")
RETURN_TYPES = ("IMAGE",)
RETURN_NAMES = ("image",)
FUNCTION = "generate"
CATEGORY = "Floyo/Flux2 Pro"
@@ -75,13 +75,15 @@ class Flux2ProTextToImage:
run_result = client.run(payload)
image_url = run_result.get("sample")
if not image_url:
return ("Error: FLUX.2 response did not include an image URL.", _blank_image())
print("Error: FLUX.2 response did not include an image URL.")
return (_blank_image(),)
image_tensor = download_image_to_tensor(image_url)
return (image_url, image_tensor)
return (image_tensor,)
except Exception as exc: # noqa: BLE001 - ComfyUI expects string errors
return (f"Error generating with FLUX.2: {exc}", _blank_image())
print(f"Error generating with FLUX.2: {exc}")
return (_blank_image(),)
class Flux2ProImageEdit:
@@ -124,8 +126,8 @@ class Flux2ProImageEdit:
},
}
RETURN_TYPES = ("STRING", "IMAGE")
RETURN_NAMES = ("image_url", "image")
RETURN_TYPES = ("IMAGE",)
RETURN_NAMES = ("image",)
FUNCTION = "edit"
CATEGORY = "Floyo/Flux2 Pro"
@@ -205,13 +207,15 @@ class Flux2ProImageEdit:
run_result = client.run(payload)
image_url = run_result.get("sample")
if not image_url:
return ("Error: FLUX.2 response did not include an image URL.", _blank_image())
print("Error: FLUX.2 response did not include an image URL.")
return (_blank_image(),)
image_tensor = download_image_to_tensor(image_url)
return (image_url, image_tensor)
return (image_tensor,)
except Exception as exc: # noqa: BLE001 - ComfyUI expects string errors
return (f"Error editing with FLUX.2: {exc}", _blank_image())
print(f"Error editing with FLUX.2: {exc}")
return (_blank_image(),)
NODE_CLASS_MAPPINGS = {