Add SD seed control

This commit is contained in:
Cohee
2024-05-29 23:29:45 +03:00
parent 31eb0235c2
commit 4eb6657b51
5 changed files with 33 additions and 5 deletions

View File

@ -608,8 +608,10 @@ together.post('/generate', jsonParser, async (request, response) => {
model: request.body.model,
steps: request.body.steps,
n: 1,
seed: Math.floor(Math.random() * 10_000_000), // Limited to 10000 on playground, works fine with more.
sessionKey: getHexString(40), // Don't know if that's supposed to be random or not. It works either way.
// Limited to 10000 on playground, works fine with more.
seed: request.body.seed >= 0 ? request.body.seed : Math.floor(Math.random() * 10_000_000),
// Don't know if that's supposed to be random or not. It works either way.
sessionKey: getHexString(40),
}),
headers: {
'Content-Type': 'application/json',
@ -736,7 +738,7 @@ pollinations.post('/generate', jsonParser, async (request, response) => {
const params = new URLSearchParams({
model: String(request.body.model),
negative_prompt: String(request.body.negative_prompt),
seed: String(Math.floor(Math.random() * 10_000_000)),
seed: String(request.body.seed >= 0 ? request.body.seed : Math.floor(Math.random() * 10_000_000)),
enhance: String(request.body.enhance ?? false),
refine: String(request.body.refine ?? false),
width: String(request.body.width ?? 1024),