Spaces:
Runtime error
Runtime error
jhj0517
commited on
Commit
•
51f1b25
1
Parent(s):
2e0064d
add mode
Browse files
app.py
CHANGED
@@ -9,23 +9,24 @@ from modules.utils import open_folder
|
|
9 |
|
10 |
class App:
|
11 |
def __init__(self,
|
12 |
-
args
|
13 |
self.app = gr.Blocks()
|
14 |
self.args = args
|
15 |
self.sam_inf = SamInference()
|
|
|
|
|
16 |
|
17 |
def launch(self):
|
18 |
with self.app:
|
19 |
with gr.Row():
|
20 |
with gr.Column(scale=5):
|
21 |
-
|
22 |
-
with gr.TabItem("Image Input"):
|
23 |
-
img_input = gr.Image(label="Input image here")
|
24 |
-
with gr.TabItem("Video Input"):
|
25 |
-
vid_input = gr.Image(label="Input video here")
|
26 |
|
27 |
with gr.Column(scale=5):
|
28 |
-
|
|
|
|
|
|
|
29 |
|
30 |
with gr.Accordion("Mask Parameters", open=False) as mask_hparams:
|
31 |
nb_points_per_side = gr.Number(label="points_per_side ", value=64, interactive=True)
|
@@ -51,7 +52,7 @@ class App:
|
|
51 |
output_file = gr.File(label="Generated psd file", scale=9)
|
52 |
btn_open_folder = gr.Button("📁\nOpen PSD folder", scale=1)
|
53 |
|
54 |
-
sources = [img_input
|
55 |
model_params = [dd_models]
|
56 |
auto_mask_hparams = [nb_points_per_side, nb_points_per_batch, sld_pred_iou_thresh,
|
57 |
sld_stability_score_thresh, sld_stability_score_offset, nb_crop_n_layers,
|
|
|
9 |
|
10 |
class App:
|
11 |
def __init__(self,
|
12 |
+
args=None):
|
13 |
self.app = gr.Blocks()
|
14 |
self.args = args
|
15 |
self.sam_inf = SamInference()
|
16 |
+
self.image_modes = ["Automatic", "Box Prompt"]
|
17 |
+
self.default_mode = self.image_modes[0]
|
18 |
|
19 |
def launch(self):
|
20 |
with self.app:
|
21 |
with gr.Row():
|
22 |
with gr.Column(scale=5):
|
23 |
+
img_input = gr.Image(label="Input image here")
|
|
|
|
|
|
|
|
|
24 |
|
25 |
with gr.Column(scale=5):
|
26 |
+
dd_modes = gr.Dropdown(label="Mode", value=self.default_mode,
|
27 |
+
choices=self.image_modes)
|
28 |
+
dd_models = gr.Dropdown(label="Model", value=DEFAULT_MODEL_TYPE,
|
29 |
+
choices=self.sam_inf.available_models)
|
30 |
|
31 |
with gr.Accordion("Mask Parameters", open=False) as mask_hparams:
|
32 |
nb_points_per_side = gr.Number(label="points_per_side ", value=64, interactive=True)
|
|
|
52 |
output_file = gr.File(label="Generated psd file", scale=9)
|
53 |
btn_open_folder = gr.Button("📁\nOpen PSD folder", scale=1)
|
54 |
|
55 |
+
sources = [img_input]
|
56 |
model_params = [dd_models]
|
57 |
auto_mask_hparams = [nb_points_per_side, nb_points_per_batch, sld_pred_iou_thresh,
|
58 |
sld_stability_score_thresh, sld_stability_score_offset, nb_crop_n_layers,
|