frontend: add ZITS config
This commit is contained in:
parent
1f8fb29594
commit
eee91e7b82
@ -17,6 +17,7 @@ export default async function inpaint(
|
|||||||
|
|
||||||
fd.append('ldmSteps', settings.ldmSteps.toString())
|
fd.append('ldmSteps', settings.ldmSteps.toString())
|
||||||
fd.append('ldmSampler', settings.ldmSampler.toString())
|
fd.append('ldmSampler', settings.ldmSampler.toString())
|
||||||
|
fd.append('zitsWireframe', settings.zitsWireframe.toString())
|
||||||
fd.append('hdStrategy', settings.hdStrategy)
|
fd.append('hdStrategy', settings.hdStrategy)
|
||||||
fd.append('hdStrategyCropMargin', settings.hdStrategyCropMargin.toString())
|
fd.append('hdStrategyCropMargin', settings.hdStrategyCropMargin.toString())
|
||||||
fd.append(
|
fd.append(
|
||||||
|
@ -2,6 +2,7 @@ import React, { ReactNode } from 'react'
|
|||||||
import { useRecoilState } from 'recoil'
|
import { useRecoilState } from 'recoil'
|
||||||
import { settingState } from '../../store/Atoms'
|
import { settingState } from '../../store/Atoms'
|
||||||
import Selector from '../shared/Selector'
|
import Selector from '../shared/Selector'
|
||||||
|
import { Switch, SwitchThumb } from '../shared/Switch'
|
||||||
import { LDMSampler } from './HDSettingBlock'
|
import { LDMSampler } from './HDSettingBlock'
|
||||||
import NumberInputSetting from './NumberInputSetting'
|
import NumberInputSetting from './NumberInputSetting'
|
||||||
import SettingBlock from './SettingBlock'
|
import SettingBlock from './SettingBlock'
|
||||||
@ -9,6 +10,7 @@ import SettingBlock from './SettingBlock'
|
|||||||
export enum AIModel {
|
export enum AIModel {
|
||||||
LAMA = 'lama',
|
LAMA = 'lama',
|
||||||
LDM = 'ldm',
|
LDM = 'ldm',
|
||||||
|
ZITS = 'ZITS',
|
||||||
}
|
}
|
||||||
|
|
||||||
function ModelSettingBlock() {
|
function ModelSettingBlock() {
|
||||||
@ -39,7 +41,7 @@ function ModelSettingBlock() {
|
|||||||
target="_blank"
|
target="_blank"
|
||||||
rel="noreferrer noopener"
|
rel="noreferrer noopener"
|
||||||
>
|
>
|
||||||
{name}
|
Paper: {name}
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
<a
|
<a
|
||||||
@ -48,7 +50,7 @@ function ModelSettingBlock() {
|
|||||||
target="_blank"
|
target="_blank"
|
||||||
rel="noreferrer noopener"
|
rel="noreferrer noopener"
|
||||||
>
|
>
|
||||||
{githubUrl}
|
Offical Repository: {githubUrl}
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
@ -89,6 +91,34 @@ function ModelSettingBlock() {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const renderZITSModelDesc = () => {
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
{renderModelDesc(
|
||||||
|
'Incremental Transformer Structure Enhanced Image Inpainting with Masking Positional Encoding',
|
||||||
|
'https://arxiv.org/abs/2203.00867',
|
||||||
|
'https://github.com/DQiaole/ZITS_inpainting'
|
||||||
|
)}
|
||||||
|
<SettingBlock
|
||||||
|
className="sub-setting-block"
|
||||||
|
title="Wireframe"
|
||||||
|
input={
|
||||||
|
<Switch
|
||||||
|
checked={setting.zitsWireframe}
|
||||||
|
onCheckedChange={checked => {
|
||||||
|
setSettingState(old => {
|
||||||
|
return { ...old, zitsWireframe: checked }
|
||||||
|
})
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<SwitchThumb />
|
||||||
|
</Switch>
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
const renderOptionDesc = (): ReactNode => {
|
const renderOptionDesc = (): ReactNode => {
|
||||||
switch (setting.model) {
|
switch (setting.model) {
|
||||||
case AIModel.LAMA:
|
case AIModel.LAMA:
|
||||||
@ -99,6 +129,8 @@ function ModelSettingBlock() {
|
|||||||
)
|
)
|
||||||
case AIModel.LDM:
|
case AIModel.LDM:
|
||||||
return renderLDMModelDesc()
|
return renderLDMModelDesc()
|
||||||
|
case AIModel.ZITS:
|
||||||
|
return renderZITSModelDesc()
|
||||||
default:
|
default:
|
||||||
return <></>
|
return <></>
|
||||||
}
|
}
|
||||||
|
@ -46,6 +46,9 @@ export interface Settings {
|
|||||||
// For LDM
|
// For LDM
|
||||||
ldmSteps: number
|
ldmSteps: number
|
||||||
ldmSampler: LDMSampler
|
ldmSampler: LDMSampler
|
||||||
|
|
||||||
|
// For ZITS
|
||||||
|
zitsWireframe: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
export const settingStateDefault = {
|
export const settingStateDefault = {
|
||||||
@ -54,8 +57,12 @@ export const settingStateDefault = {
|
|||||||
graduallyInpainting: true,
|
graduallyInpainting: true,
|
||||||
runInpaintingManually: false,
|
runInpaintingManually: false,
|
||||||
model: AIModel.LAMA,
|
model: AIModel.LAMA,
|
||||||
|
|
||||||
ldmSteps: 50,
|
ldmSteps: 50,
|
||||||
ldmSampler: LDMSampler.plms,
|
ldmSampler: LDMSampler.plms,
|
||||||
|
|
||||||
|
zitsWireframe: true,
|
||||||
|
|
||||||
hdStrategy: HDStrategy.RESIZE,
|
hdStrategy: HDStrategy.RESIZE,
|
||||||
hdStrategyResizeLimit: 2048,
|
hdStrategyResizeLimit: 2048,
|
||||||
hdStrategyCropTrigerSize: 2048,
|
hdStrategyCropTrigerSize: 2048,
|
||||||
|
@ -95,6 +95,7 @@ def process():
|
|||||||
ldm_steps=form["ldmSteps"],
|
ldm_steps=form["ldmSteps"],
|
||||||
ldm_sampler=form["ldmSampler"],
|
ldm_sampler=form["ldmSampler"],
|
||||||
hd_strategy=form["hdStrategy"],
|
hd_strategy=form["hdStrategy"],
|
||||||
|
zits_wireframe=form["zitsWireframe"],
|
||||||
hd_strategy_crop_margin=form["hdStrategyCropMargin"],
|
hd_strategy_crop_margin=form["hdStrategyCropMargin"],
|
||||||
hd_strategy_crop_trigger_size=form["hdStrategyCropTrigerSize"],
|
hd_strategy_crop_trigger_size=form["hdStrategyCropTrigerSize"],
|
||||||
hd_strategy_resize_limit=form["hdStrategyResizeLimit"],
|
hd_strategy_resize_limit=form["hdStrategyResizeLimit"],
|
||||||
|
Loading…
Reference in New Issue
Block a user