change default interactive_seg_device to cpu;add interactive seg model/device to web_config

This commit is contained in:
Qing 2023-04-16 09:41:35 +08:00
parent 6750df13e7
commit d3f6f69af6
2 changed files with 19 additions and 3 deletions

View File

@ -141,7 +141,7 @@ class Config(BaseModel):
# plugins # plugins
enable_interactive_seg: bool = False enable_interactive_seg: bool = False
interactive_seg_model: str = "vit_l" interactive_seg_model: str = "vit_l"
interactive_seg_device: str = "cuda" interactive_seg_device: str = "cpu"
enable_remove_bg: bool = False enable_remove_bg: bool = False
enable_realesrgan: bool = False enable_realesrgan: bool = False
realesrgan_device: str = "cpu" realesrgan_device: str = "cpu"

View File

@ -30,6 +30,8 @@ def save_config(
output_dir, output_dir,
quality, quality,
enable_interactive_seg, enable_interactive_seg,
interactive_seg_model,
interactive_seg_device,
enable_remove_bg, enable_remove_bg,
enable_realesrgan, enable_realesrgan,
realesrgan_device, realesrgan_device,
@ -119,9 +121,21 @@ def main(config_file: str):
enable_interactive_seg = gr.Checkbox( enable_interactive_seg = gr.Checkbox(
init_config.enable_interactive_seg, label=INTERACTIVE_SEG_HELP init_config.enable_interactive_seg, label=INTERACTIVE_SEG_HELP
) )
enable_remove_bg = gr.Checkbox( interactive_seg_model = gr.Radio(
init_config.enable_remove_bg, label=REMOVE_BG_HELP AVAILABLE_INTERACTIVE_SEG_MODELS,
label="Segment Anything models. Model size: vit_b < vit_l < vit_h. Bigger model size means better segmentation but slower speed.",
value=init_config.interactive_seg_model,
) )
interactive_seg_device = gr.Radio(
AVAILABLE_INTERACTIVE_SEG_DEVICES,
label="Segment Anything Device",
value=init_config.interactive_seg_device,
)
with gr.Row():
enable_remove_bg = gr.Checkbox(
init_config.enable_remove_bg, label=REMOVE_BG_HELP
)
with gr.Row(): with gr.Row():
enable_realesrgan = gr.Checkbox( enable_realesrgan = gr.Checkbox(
init_config.enable_realesrgan, label=REALESRGAN_HELP init_config.enable_realesrgan, label=REALESRGAN_HELP
@ -202,6 +216,8 @@ def main(config_file: str):
output_dir, output_dir,
quality, quality,
enable_interactive_seg, enable_interactive_seg,
interactive_seg_model,
interactive_seg_device,
enable_remove_bg, enable_remove_bg,
enable_realesrgan, enable_realesrgan,
realesrgan_device, realesrgan_device,