update
This commit is contained in:
parent
468e698a5c
commit
4561d5c31b
@ -21,10 +21,8 @@ from loguru import logger
|
|||||||
|
|
||||||
from iopaint.const import *
|
from iopaint.const import *
|
||||||
|
|
||||||
|
|
||||||
_config_file: Path = None
|
_config_file: Path = None
|
||||||
|
|
||||||
|
|
||||||
default_configs = dict(
|
default_configs = dict(
|
||||||
host="127.0.0.1",
|
host="127.0.0.1",
|
||||||
port=8080,
|
port=8080,
|
||||||
@ -67,41 +65,41 @@ def load_config(p: Path) -> WebConfig:
|
|||||||
try:
|
try:
|
||||||
return WebConfig(**{**default_configs, **json.load(f)})
|
return WebConfig(**{**default_configs, **json.load(f)})
|
||||||
except JSONDecodeError:
|
except JSONDecodeError:
|
||||||
print(f"Load config file failed, using default configs")
|
print("Load config file failed, using default configs")
|
||||||
return WebConfig(**default_configs)
|
return WebConfig(**default_configs)
|
||||||
else:
|
else:
|
||||||
return WebConfig(**default_configs)
|
return WebConfig(**default_configs)
|
||||||
|
|
||||||
|
|
||||||
def save_config(
|
def save_config(
|
||||||
host,
|
host,
|
||||||
port,
|
port,
|
||||||
model,
|
model,
|
||||||
model_dir,
|
model_dir,
|
||||||
no_half,
|
no_half,
|
||||||
low_mem,
|
low_mem,
|
||||||
cpu_offload,
|
cpu_offload,
|
||||||
disable_nsfw_checker,
|
disable_nsfw_checker,
|
||||||
local_files_only,
|
local_files_only,
|
||||||
cpu_textencoder,
|
cpu_textencoder,
|
||||||
device,
|
device,
|
||||||
input,
|
input,
|
||||||
output_dir,
|
output_dir,
|
||||||
quality,
|
quality,
|
||||||
enable_interactive_seg,
|
enable_interactive_seg,
|
||||||
interactive_seg_model,
|
interactive_seg_model,
|
||||||
interactive_seg_device,
|
interactive_seg_device,
|
||||||
enable_remove_bg,
|
enable_remove_bg,
|
||||||
remove_bg_model,
|
remove_bg_model,
|
||||||
enable_anime_seg,
|
enable_anime_seg,
|
||||||
enable_realesrgan,
|
enable_realesrgan,
|
||||||
realesrgan_device,
|
realesrgan_device,
|
||||||
realesrgan_model,
|
realesrgan_model,
|
||||||
enable_gfpgan,
|
enable_gfpgan,
|
||||||
gfpgan_device,
|
gfpgan_device,
|
||||||
enable_restoreformer,
|
enable_restoreformer,
|
||||||
restoreformer_device,
|
restoreformer_device,
|
||||||
inbrowser,
|
inbrowser,
|
||||||
):
|
):
|
||||||
config = WebConfig(**locals())
|
config = WebConfig(**locals())
|
||||||
if str(config.input) == ".":
|
if str(config.input) == ".":
|
||||||
@ -150,13 +148,6 @@ def main(config_file: Path):
|
|||||||
port = gr.Number(init_config.port, label="Port", precision=0)
|
port = gr.Number(init_config.port, label="Port", precision=0)
|
||||||
inbrowser = gr.Checkbox(init_config.inbrowser, label=INBROWSER_HELP)
|
inbrowser = gr.Checkbox(init_config.inbrowser, label=INBROWSER_HELP)
|
||||||
|
|
||||||
with gr.Column():
|
|
||||||
model = gr.Textbox(
|
|
||||||
init_config.model,
|
|
||||||
label="Current Model. This is the model that will be used when the service starts. "
|
|
||||||
"If the model has not been downloaded before, it will be automatically downloaded. "
|
|
||||||
"You can select a model from the dropdown box below or manually enter the SD/SDXL model ID from HuggingFace, for example, runwayml/stable-diffusion-inpainting.",
|
|
||||||
)
|
|
||||||
with gr.Row():
|
with gr.Row():
|
||||||
recommend_model = gr.Dropdown(
|
recommend_model = gr.Dropdown(
|
||||||
["lama", "mat", "migan"] + DIFFUSION_MODELS,
|
["lama", "mat", "migan"] + DIFFUSION_MODELS,
|
||||||
@ -165,6 +156,12 @@ def main(config_file: Path):
|
|||||||
downloaded_model = gr.Dropdown(
|
downloaded_model = gr.Dropdown(
|
||||||
downloaded_models, label="Downloaded Models"
|
downloaded_models, label="Downloaded Models"
|
||||||
)
|
)
|
||||||
|
with gr.Column():
|
||||||
|
model = gr.Textbox(
|
||||||
|
init_config.model,
|
||||||
|
label="Current Model. Model will be automatically downloaded. "
|
||||||
|
"You can select a model in Recommended Models or Downloaded Models or manually enter the SD/SDXL model ID from HuggingFace, for example, runwayml/stable-diffusion-inpainting.",
|
||||||
|
)
|
||||||
|
|
||||||
device = gr.Radio(
|
device = gr.Radio(
|
||||||
Device.values(), label="Device", value=init_config.device
|
Device.values(), label="Device", value=init_config.device
|
||||||
|
Loading…
Reference in New Issue
Block a user