Spaces:
Runtime error
Runtime error
jhj0517
commited on
Commit
•
0cb1388
1
Parent(s):
3810a85
Add `cb_multimask_output`
Browse files
app.py
CHANGED
@@ -27,11 +27,11 @@ class App:
|
|
27 |
return [
|
28 |
gr.Image(visible=mode == AUTOMATIC_MODE),
|
29 |
ImagePrompter(visible=mode == BOX_PROMPT_MODE),
|
30 |
-
gr.Accordion(visible=mode == AUTOMATIC_MODE)
|
31 |
]
|
32 |
|
33 |
def launch(self):
|
34 |
-
|
35 |
|
36 |
with self.app:
|
37 |
with gr.Row():
|
@@ -47,23 +47,25 @@ class App:
|
|
47 |
choices=self.sam_inf.available_models)
|
48 |
|
49 |
with gr.Accordion("Mask Parameters", open=False) as acc_mask_hparams:
|
50 |
-
nb_points_per_side = gr.Number(label="points_per_side ", value=
|
51 |
interactive=True)
|
52 |
-
nb_points_per_batch = gr.Number(label="points_per_batch ", value=
|
53 |
interactive=True)
|
54 |
-
sld_pred_iou_thresh = gr.Slider(label="pred_iou_thresh ", value=
|
55 |
minimum=0, maximum=1, interactive=True)
|
56 |
-
sld_stability_score_thresh = gr.Slider(label="stability_score_thresh ", value=
|
57 |
minimum=0, maximum=1, interactive=True)
|
58 |
-
sld_stability_score_offset = gr.Slider(label="stability_score_offset ", value=
|
59 |
minimum=0, maximum=1)
|
60 |
-
nb_crop_n_layers = gr.Number(label="crop_n_layers ", value=
|
61 |
-
sld_box_nms_thresh = gr.Slider(label="box_nms_thresh ", value=
|
62 |
minimum=0, maximum=1)
|
63 |
nb_crop_n_points_downscale_factor = gr.Number(label="crop_n_points_downscale_factor ",
|
64 |
-
value=
|
65 |
-
nb_min_mask_region_area = gr.Number(label="min_mask_region_area ", value=
|
66 |
-
cb_use_m2m = gr.Checkbox(label="use_m2m ", value=
|
|
|
|
|
67 |
|
68 |
with gr.Row():
|
69 |
btn_generate = gr.Button("GENERATE", variant="primary")
|
@@ -75,13 +77,13 @@ class App:
|
|
75 |
|
76 |
sources = [img_input, img_input_prompter, dd_input_modes]
|
77 |
model_params = [dd_models]
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
|
83 |
btn_generate.click(fn=self.sam_inf.divide_layer,
|
84 |
-
inputs=sources + model_params +
|
85 |
btn_open_folder.click(fn=lambda: open_folder(os.path.join(OUTPUT_DIR)),
|
86 |
inputs=None, outputs=None)
|
87 |
|
|
|
27 |
return [
|
28 |
gr.Image(visible=mode == AUTOMATIC_MODE),
|
29 |
ImagePrompter(visible=mode == BOX_PROMPT_MODE),
|
30 |
+
gr.Accordion(visible=mode == AUTOMATIC_MODE),
|
31 |
]
|
32 |
|
33 |
def launch(self):
|
34 |
+
_mask_hparams = self.hparams["mask_hparams"]
|
35 |
|
36 |
with self.app:
|
37 |
with gr.Row():
|
|
|
47 |
choices=self.sam_inf.available_models)
|
48 |
|
49 |
with gr.Accordion("Mask Parameters", open=False) as acc_mask_hparams:
|
50 |
+
nb_points_per_side = gr.Number(label="points_per_side ", value=_mask_hparams["points_per_side"],
|
51 |
interactive=True)
|
52 |
+
nb_points_per_batch = gr.Number(label="points_per_batch ", value=_mask_hparams["points_per_batch"],
|
53 |
interactive=True)
|
54 |
+
sld_pred_iou_thresh = gr.Slider(label="pred_iou_thresh ", value=_mask_hparams["pred_iou_thresh"],
|
55 |
minimum=0, maximum=1, interactive=True)
|
56 |
+
sld_stability_score_thresh = gr.Slider(label="stability_score_thresh ", value=_mask_hparams["stability_score_thresh"],
|
57 |
minimum=0, maximum=1, interactive=True)
|
58 |
+
sld_stability_score_offset = gr.Slider(label="stability_score_offset ", value=_mask_hparams["stability_score_offset"],
|
59 |
minimum=0, maximum=1)
|
60 |
+
nb_crop_n_layers = gr.Number(label="crop_n_layers ", value=_mask_hparams["crop_n_layers"],)
|
61 |
+
sld_box_nms_thresh = gr.Slider(label="box_nms_thresh ", value=_mask_hparams["box_nms_thresh"],
|
62 |
minimum=0, maximum=1)
|
63 |
nb_crop_n_points_downscale_factor = gr.Number(label="crop_n_points_downscale_factor ",
|
64 |
+
value=_mask_hparams["crop_n_points_downscale_factor"],)
|
65 |
+
nb_min_mask_region_area = gr.Number(label="min_mask_region_area ", value=_mask_hparams["min_mask_region_area"],)
|
66 |
+
cb_use_m2m = gr.Checkbox(label="use_m2m ", value=_mask_hparams["use_m2m"])
|
67 |
+
|
68 |
+
cb_multimask_output = gr.Checkbox(label="multimask_output", value=_mask_hparams["multimask_output"])
|
69 |
|
70 |
with gr.Row():
|
71 |
btn_generate = gr.Button("GENERATE", variant="primary")
|
|
|
77 |
|
78 |
sources = [img_input, img_input_prompter, dd_input_modes]
|
79 |
model_params = [dd_models]
|
80 |
+
mask_hparams = [nb_points_per_side, nb_points_per_batch, sld_pred_iou_thresh,
|
81 |
+
sld_stability_score_thresh, sld_stability_score_offset, nb_crop_n_layers,
|
82 |
+
sld_box_nms_thresh, nb_crop_n_points_downscale_factor, nb_min_mask_region_area,
|
83 |
+
cb_use_m2m, cb_multimask_output]
|
84 |
|
85 |
btn_generate.click(fn=self.sam_inf.divide_layer,
|
86 |
+
inputs=sources + model_params + mask_hparams, outputs=[gallery_output, output_file])
|
87 |
btn_open_folder.click(fn=lambda: open_folder(os.path.join(OUTPUT_DIR)),
|
88 |
inputs=None, outputs=None)
|
89 |
|