Spaces:
Runtime error
Runtime error
jhj0517
commited on
Commit
•
4d105da
1
Parent(s):
41938cd
Update default input mode
Browse files
app.py
CHANGED
@@ -18,7 +18,7 @@ class App:
|
|
18 |
self.args = args
|
19 |
self.sam_inf = SamInference()
|
20 |
self.image_modes = [AUTOMATIC_MODE, BOX_PROMPT_MODE]
|
21 |
-
self.default_mode =
|
22 |
default_param_config_path = os.path.join(SAM2_CONFIGS_DIR, "default_hparams.yaml")
|
23 |
with open(default_param_config_path, 'r') as file:
|
24 |
self.hparams = yaml.safe_load(file)
|
@@ -58,7 +58,7 @@ class App:
|
|
58 |
with self.app:
|
59 |
with gr.Row():
|
60 |
with gr.Column(scale=5):
|
61 |
-
img_input = gr.Image(label="Input image here")
|
62 |
img_input_prompter = ImagePrompter(label="Prompt image with Box & Point", type='pil',
|
63 |
visible=self.default_mode == BOX_PROMPT_MODE)
|
64 |
|
@@ -68,7 +68,7 @@ class App:
|
|
68 |
dd_models = gr.Dropdown(label="Model", value=DEFAULT_MODEL_TYPE,
|
69 |
choices=self.sam_inf.available_models)
|
70 |
|
71 |
-
with gr.Accordion("Mask Parameters", open=False) as acc_mask_hparams:
|
72 |
mask_hparams_component = self.mask_parameters(_mask_hparams)
|
73 |
|
74 |
cb_multimask_output = gr.Checkbox(label="multimask_output", value=_mask_hparams["multimask_output"])
|
|
|
18 |
self.args = args
|
19 |
self.sam_inf = SamInference()
|
20 |
self.image_modes = [AUTOMATIC_MODE, BOX_PROMPT_MODE]
|
21 |
+
self.default_mode = BOX_PROMPT_MODE
|
22 |
default_param_config_path = os.path.join(SAM2_CONFIGS_DIR, "default_hparams.yaml")
|
23 |
with open(default_param_config_path, 'r') as file:
|
24 |
self.hparams = yaml.safe_load(file)
|
|
|
58 |
with self.app:
|
59 |
with gr.Row():
|
60 |
with gr.Column(scale=5):
|
61 |
+
img_input = gr.Image(label="Input image here", visible=self.default_mode == AUTOMATIC_MODE)
|
62 |
img_input_prompter = ImagePrompter(label="Prompt image with Box & Point", type='pil',
|
63 |
visible=self.default_mode == BOX_PROMPT_MODE)
|
64 |
|
|
|
68 |
dd_models = gr.Dropdown(label="Model", value=DEFAULT_MODEL_TYPE,
|
69 |
choices=self.sam_inf.available_models)
|
70 |
|
71 |
+
with gr.Accordion("Mask Parameters", open=False, visible=self.default_mode == AUTOMATIC_MODE) as acc_mask_hparams:
|
72 |
mask_hparams_component = self.mask_parameters(_mask_hparams)
|
73 |
|
74 |
cb_multimask_output = gr.Checkbox(label="multimask_output", value=_mask_hparams["multimask_output"])
|