mirror of
https://github.com/koishijs/novelai-bot
synced 2025-01-07 07:06:54 +08:00
feat: support stable horde restore faces
This commit is contained in:
parent
ac3b6e64fc
commit
d7bde353fd
@ -156,7 +156,7 @@ interface ParamConfig {
|
||||
textSteps?: number
|
||||
imageSteps?: number
|
||||
maxSteps?: number
|
||||
restoreFaces?: boolean
|
||||
restoreFaces?: 'CodeFormer' | 'GFPGAN' | boolean
|
||||
hiresFix?: boolean
|
||||
}
|
||||
|
||||
@ -248,6 +248,11 @@ export const Config = Schema.intersect([
|
||||
type: Schema.const('stable-horde'),
|
||||
sampler: sampler.createSchema(sampler.horde),
|
||||
model: Schema.union(hordeModels),
|
||||
restoreFaces: Schema.union([
|
||||
Schema.const(false).description('禁用'),
|
||||
Schema.const('CodeFormer').description('使用 CodeFormer'),
|
||||
Schema.const('GFPGAN').description('使用 GFPGAN'),
|
||||
]).description('是否启用人脸修复。').default(false),
|
||||
}),
|
||||
Schema.object({
|
||||
type: Schema.const('naifu'),
|
||||
|
@ -270,7 +270,7 @@ export function apply(ctx: Context, config: Config) {
|
||||
return {
|
||||
sampler_index: sampler.sd[options.sampler],
|
||||
init_images: image && [image.dataUrl], // sd-webui accepts data URLs with base64 encoded image
|
||||
restore_faces: config.restoreFaces ?? false,
|
||||
restore_faces: config.restoreFaces === true,
|
||||
enable_hr: options.hiresFix ?? config.hiresFix ?? false,
|
||||
...project(parameters, {
|
||||
prompt: 'prompt',
|
||||
@ -286,6 +286,10 @@ export function apply(ctx: Context, config: Config) {
|
||||
}
|
||||
}
|
||||
case 'stable-horde': {
|
||||
const postProcessing = []
|
||||
if (typeof config.restoreFaces === 'string') {
|
||||
postProcessing.push(config.restoreFaces)
|
||||
}
|
||||
return {
|
||||
prompt: parameters.prompt,
|
||||
params: {
|
||||
@ -295,7 +299,7 @@ export function apply(ctx: Context, config: Config) {
|
||||
seed: parameters.seed.toString(),
|
||||
height: parameters.height,
|
||||
width: parameters.width,
|
||||
post_processing: [],
|
||||
post_processing: postProcessing,
|
||||
karras: options.sampler.includes('_ka'),
|
||||
steps: parameters.steps,
|
||||
n: 1,
|
||||
|
Loading…
Reference in New Issue
Block a user