Compare commits

...
Author SHA1 Message Date
israelweiss90 28c0cdf8d5 image expansion & remove fg- content moderation 2025-02-02 16:14:02 +00:00
BriaOr 4f7691ff93 Merge pull request #14 from Bria-AI/bugfi/rmbg-temp-file
temp file to buffer to avoid OS dependency
2025-02-02 14:08:39 +02:00
2 changed files with 9 additions and 4 deletions
+4 -2
View File
@@ -23,6 +23,7 @@ class ImageExpansionNode():
"prompt": ("STRING", {"default": ""}),
"seed": ("INT", {"default": 681794}),
"negative_prompt": ("STRING", {"default": "Ugly, mutated"}),
"content_moderation": ("BOOLEAN", {"default": False}),
}
}
@@ -42,6 +43,7 @@ class ImageExpansionNode():
prompt,
seed,
negative_prompt,
content_moderation,
api_key):
if api_key.strip() == "" or api_key.strip() == "BRIA_API_TOKEN":
raise Exception("Please insert a valid API key.")
@@ -70,8 +72,8 @@ class ImageExpansionNode():
"canvas_size": canvas_size,
"prompt": prompt,
"negative_prompt": negative_prompt,
"seed": seed
# "sync": True
"seed": seed,
"content_moderation": content_moderation
}
headers = {
+5 -2
View File
@@ -15,6 +15,9 @@ class RemoveForegroundNode():
"image": ("IMAGE",), # Input image from another node
"api_key": ("STRING", {"default": "BRIA_API_TOKEN"}), # API Key input with a default value
},
"optional": {
"content_moderation": ("BOOLEAN", {"default": False}),
}
}
RETURN_TYPES = ("IMAGE",)
@@ -26,7 +29,7 @@ class RemoveForegroundNode():
self.api_url = "https://engine.internal.prod.bria-api.com/v1/erase_foreground" # remove foreground API URL
# Define the execute method as expected by ComfyUI
def execute(self, image, api_key):
def execute(self, image, content_moderation, api_key):
if api_key.strip() == "" or api_key.strip() == "BRIA_API_TOKEN":
raise Exception("Please insert a valid API key.")
@@ -41,7 +44,7 @@ class RemoveForegroundNode():
# files=[('file',('temp_img.jpeg', open(temp_img_path, 'rb'),'image/jpeg'))
# ]
payload = {"file": image_to_base64(image)}
payload = {"file": image_to_base64(image), "content_moderation": content_moderation}
headers = {
"Content-Type": "application/json",