File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change 5252import base64
5353import json
5454import os
55+ import random
5556import re
5657from typing import Any , List , Tuple
5758
8182 },
8283 "seed" : {
8384 "type" : "integer" ,
84- "description" : "Optional: Seed for deterministic generation (default: 2147483646 )" ,
85+ "description" : "Optional: Seed for deterministic generation (default: random )" ,
8586 },
8687 "cfg_scale" : {
8788 "type" : "number" ,
@@ -233,7 +234,7 @@ def generate_image(tool: ToolUse, **kwargs: Any) -> ToolResult:
233234 - prompt: The text prompt describing the desired image.
234235 - model_id: Optional model identifier.
235236 - region: Optional AWS region (default: from AWS_REGION env variable or us-west-2).
236- - seed: Optional seed value (default: 2147483646).
237+ - seed: Optional seed value (default: random integer b/w O and 2147483646).
237238 - cfg_scale: Optional CFG scale value (default: 10).
238239 **kwargs: Additional keyword arguments (unused).
239240
@@ -296,7 +297,8 @@ def generate_image(tool: ToolUse, **kwargs: Any) -> ToolResult:
296297 }
297298
298299 # Get seed from input or use a default value that works for all models
299- seed = tool_input .get ("seed" , 2147483646 )
300+ # Keeping range's end to 2147483646 as this is the max seed value supported by Nova models
301+ seed = tool_input .get ("seed" , random .randint (0 , 2147483646 ))
300302 cfg_scale = tool_input .get ("cfg_scale" , 10 )
301303
302304 # Validate if the model is available in the specified region
You can’t perform that action at this time.
0 commit comments