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 52
52
import base64
53
53
import json
54
54
import os
55
+ import random
55
56
import re
56
57
from typing import Any , List , Tuple
57
58
81
82
},
82
83
"seed" : {
83
84
"type" : "integer" ,
84
- "description" : "Optional: Seed for deterministic generation (default: 2147483646 )" ,
85
+ "description" : "Optional: Seed for deterministic generation (default: random )" ,
85
86
},
86
87
"cfg_scale" : {
87
88
"type" : "number" ,
@@ -233,7 +234,7 @@ def generate_image(tool: ToolUse, **kwargs: Any) -> ToolResult:
233
234
- prompt: The text prompt describing the desired image.
234
235
- model_id: Optional model identifier.
235
236
- 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).
237
238
- cfg_scale: Optional CFG scale value (default: 10).
238
239
**kwargs: Additional keyword arguments (unused).
239
240
@@ -296,7 +297,8 @@ def generate_image(tool: ToolUse, **kwargs: Any) -> ToolResult:
296
297
}
297
298
298
299
# 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 ))
300
302
cfg_scale = tool_input .get ("cfg_scale" , 10 )
301
303
302
304
# Validate if the model is available in the specified region
You can’t perform that action at this time.
0 commit comments