Skip to content

Commit

Permalink
add random seed as a param
Browse files Browse the repository at this point in the history
  • Loading branch information
andantei committed Feb 28, 2023
1 parent 841993b commit 2316ef7
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,25 @@ def params(song: Song, read_apis: ReadAPIs) -> Dict[str, ParamDescriptor]:
"step": 2.5
}
}
},
"randomSeed": {
"displayName": {
"en": "Random Seed",
"zh": "随机因子"
},
"defaultValue": 42,
"description": {
"en": "Using the same params and random seed generates the same response",
"zh": "使用相同的参数值和随机因子可以生成相同的结果"
},
"widget": {
"type": WidgetType.InputNumber.value,
"config": {
"minValue": 1,
"maxValue": 99999999,
"step": 1
}
}
}
}

Expand All @@ -96,7 +115,7 @@ def run(song: Song, params: Dict[str, Any], read_apis: ReadAPIs):
duration=params["duration"],
guidance_scale=params["guidance_scale"],
# Randomize seed.
random_seed=random.randint(0, 999999))
random_seed=params["randomSeed"])
for file_bytes in file_bytes_list:
try:
file_bytes.seek(0)
Expand Down

0 comments on commit 2316ef7

Please sign in to comment.