Skip to content

Commit 4471fb4

Browse files
committed
pro 1.1
1 parent 929a144 commit 4471fb4

File tree

1 file changed

+44
-3
lines changed

1 file changed

+44
-3
lines changed

nodes/api_node.py

+44-3
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,45 @@ def generate_image(self, prompt, image_size, num_inference_steps, num_images, en
141141
print(f"Error generating image with FluxSchnell: {str(e)}")
142142
return self.create_blank_image()
143143

144+
class FluxPro11:
145+
@classmethod
146+
def INPUT_TYPES(cls):
147+
return {
148+
"required": {
149+
"prompt": ("STRING", {"default": "", "multiline": True}),
150+
"image_size": (["square_hd", "square", "portrait_4_3", "portrait_16_9", "landscape_4_3", "landscape_16_9"], {"default": "landscape_4_3"}),
151+
"num_images": ("INT", {"default": 1, "min": 1, "max": 10}),
152+
"safety_tolerance": (["1", "2", "3", "4", "5", "6"], {"default": "2"}),
153+
},
154+
"optional": {
155+
"seed": ("INT", {"default": -1}),
156+
"sync_mode": ("BOOLEAN", {"default": False}),
157+
}
158+
}
159+
160+
RETURN_TYPES = ("IMAGE",)
161+
FUNCTION = "generate_image"
162+
CATEGORY = "FAL"
163+
164+
def generate_image(self, prompt, image_size, num_images, safety_tolerance, seed=-1, sync_mode=False):
165+
arguments = {
166+
"prompt": prompt,
167+
"image_size": image_size,
168+
"num_images": num_images,
169+
"safety_tolerance": safety_tolerance,
170+
"sync_mode": sync_mode
171+
}
172+
if seed != -1:
173+
arguments["seed"] = seed
174+
175+
try:
176+
handler = submit("fal-ai/flux-pro/v1.1", arguments=arguments)
177+
result = handler.get()
178+
return self.process_result(result)
179+
except Exception as e:
180+
print(f"Error generating image with FluxPro 1.1: {str(e)}")
181+
return self.create_blank_image()
182+
144183
# Common methods for all classes
145184
def process_result(self, result):
146185
images = []
@@ -166,20 +205,22 @@ def create_blank_image(self):
166205
return (img_tensor,)
167206

168207
# Add common methods to all classes
169-
for cls in [FluxPro, FluxDev, FluxSchnell]:
208+
for cls in [FluxPro, FluxDev, FluxSchnell, FluxPro11]:
170209
cls.process_result = process_result
171210
cls.create_blank_image = create_blank_image
172211

173212
# Node class mappings
174213
NODE_CLASS_MAPPINGS = {
175214
"FluxPro_fal": FluxPro,
176215
"FluxDev_fal": FluxDev,
177-
"FluxSchnell_fal": FluxSchnell
216+
"FluxSchnell_fal": FluxSchnell,
217+
"FluxPro11_fal": FluxPro11
178218
}
179219

180220
# Node display name mappings
181221
NODE_DISPLAY_NAME_MAPPINGS = {
182222
"FluxPro_fal": "Flux Pro (fal)",
183223
"FluxDev_fal": "Flux Dev (fal)",
184-
"FluxSchnell_fal": "Flux Schnell (fal)"
224+
"FluxSchnell_fal": "Flux Schnell (fal)",
225+
"FluxPro11_fal": "Flux Pro 1.1 (fal)"
185226
}

0 commit comments

Comments
 (0)