Spaces:
Runtime error
Runtime error
jhj0517
commited on
Commit
•
998201e
1
Parent(s):
a5febdb
Update tab location
Browse files
app.py
CHANGED
@@ -108,48 +108,9 @@ class App:
|
|
108 |
md_header = gr.Markdown(HEADER, elem_id="md_header")
|
109 |
|
110 |
with gr.Tabs():
|
111 |
-
with gr.TabItem("
|
112 |
-
with gr.Row():
|
113 |
-
with gr.Column(scale=5):
|
114 |
-
img_input = gr.Image(label="Input image here", visible=self.default_mode == AUTOMATIC_MODE)
|
115 |
-
img_input_prompter = ImagePrompter(label="Prompt image with Box & Point", type='pil',
|
116 |
-
visible=self.default_mode == BOX_PROMPT_MODE)
|
117 |
-
|
118 |
-
with gr.Column(scale=5):
|
119 |
-
dd_input_modes = gr.Dropdown(label="Image Input Mode", value=self.default_mode,
|
120 |
-
choices=self.image_modes)
|
121 |
-
dd_models = gr.Dropdown(label="Model", value=DEFAULT_MODEL_TYPE,
|
122 |
-
choices=self.sam_inf.available_models)
|
123 |
-
|
124 |
-
with gr.Accordion("Mask Parameters", open=False, visible=self.default_mode == AUTOMATIC_MODE) as acc_mask_hparams:
|
125 |
-
mask_hparams_component = self.mask_generation_parameters(_mask_hparams)
|
126 |
-
|
127 |
-
cb_multimask_output = gr.Checkbox(label="multimask_output", value=_mask_hparams["multimask_output"])
|
128 |
-
|
129 |
-
with gr.Row():
|
130 |
-
btn_generate = gr.Button("GENERATE", variant="primary")
|
131 |
-
with gr.Row():
|
132 |
-
gallery_output = gr.Gallery(label="Output images will be shown here")
|
133 |
-
with gr.Column():
|
134 |
-
output_file = gr.File(label="Generated psd file", scale=9)
|
135 |
-
btn_open_folder = gr.Button("📁\nOpen PSD folder", scale=1)
|
136 |
-
|
137 |
-
sources = [img_input, img_input_prompter, dd_input_modes]
|
138 |
-
model_params = [dd_models]
|
139 |
-
mask_hparams = mask_hparams_component + [cb_multimask_output]
|
140 |
-
input_params = sources + model_params + mask_hparams
|
141 |
-
|
142 |
-
btn_generate.click(fn=self.sam_inf.divide_layer,
|
143 |
-
inputs=input_params, outputs=[gallery_output, output_file])
|
144 |
-
btn_open_folder.click(fn=lambda: open_folder(os.path.join(self.args.output_dir, "psd")),
|
145 |
-
inputs=None, outputs=None)
|
146 |
-
dd_input_modes.change(fn=self.on_mode_change,
|
147 |
-
inputs=[dd_input_modes],
|
148 |
-
outputs=[img_input, img_input_prompter, acc_mask_hparams])
|
149 |
-
|
150 |
-
with gr.TabItem("Pixelize Filter"):
|
151 |
with gr.Column():
|
152 |
-
file_vid_input = gr.File(label="Input Video", file_types=IMAGE_FILE_EXT + VIDEO_FILE_EXT)
|
153 |
with gr.Row(equal_height=True):
|
154 |
with gr.Column(scale=9):
|
155 |
with gr.Row():
|
@@ -207,6 +168,45 @@ class App:
|
|
207 |
inputs=None,
|
208 |
outputs=None)
|
209 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
210 |
self.demo.queue().launch(
|
211 |
inbrowser=self.args.inbrowser,
|
212 |
share=self.args.share,
|
|
|
108 |
md_header = gr.Markdown(HEADER, elem_id="md_header")
|
109 |
|
110 |
with gr.Tabs():
|
111 |
+
with gr.TabItem("Filter to Video"):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
112 |
with gr.Column():
|
113 |
+
file_vid_input = gr.File(label="Upload Input Video", file_types=IMAGE_FILE_EXT + VIDEO_FILE_EXT)
|
114 |
with gr.Row(equal_height=True):
|
115 |
with gr.Column(scale=9):
|
116 |
with gr.Row():
|
|
|
168 |
inputs=None,
|
169 |
outputs=None)
|
170 |
|
171 |
+
with gr.TabItem("Layer Divider"):
|
172 |
+
with gr.Row():
|
173 |
+
with gr.Column(scale=5):
|
174 |
+
img_input = gr.Image(label="Input image here", visible=self.default_mode == AUTOMATIC_MODE)
|
175 |
+
img_input_prompter = ImagePrompter(label="Prompt image with Box & Point", type='pil',
|
176 |
+
visible=self.default_mode == BOX_PROMPT_MODE)
|
177 |
+
|
178 |
+
with gr.Column(scale=5):
|
179 |
+
dd_input_modes = gr.Dropdown(label="Image Input Mode", value=self.default_mode,
|
180 |
+
choices=self.image_modes)
|
181 |
+
dd_models = gr.Dropdown(label="Model", value=DEFAULT_MODEL_TYPE,
|
182 |
+
choices=self.sam_inf.available_models)
|
183 |
+
|
184 |
+
with gr.Accordion("Mask Parameters", open=False, visible=self.default_mode == AUTOMATIC_MODE) as acc_mask_hparams:
|
185 |
+
mask_hparams_component = self.mask_generation_parameters(_mask_hparams)
|
186 |
+
|
187 |
+
cb_multimask_output = gr.Checkbox(label="multimask_output", value=_mask_hparams["multimask_output"])
|
188 |
+
|
189 |
+
with gr.Row():
|
190 |
+
btn_generate = gr.Button("GENERATE", variant="primary")
|
191 |
+
with gr.Row():
|
192 |
+
gallery_output = gr.Gallery(label="Output images will be shown here")
|
193 |
+
with gr.Column():
|
194 |
+
output_file = gr.File(label="Generated psd file", scale=9)
|
195 |
+
btn_open_folder = gr.Button("📁\nOpen PSD folder", scale=1)
|
196 |
+
|
197 |
+
sources = [img_input, img_input_prompter, dd_input_modes]
|
198 |
+
model_params = [dd_models]
|
199 |
+
mask_hparams = mask_hparams_component + [cb_multimask_output]
|
200 |
+
input_params = sources + model_params + mask_hparams
|
201 |
+
|
202 |
+
btn_generate.click(fn=self.sam_inf.divide_layer,
|
203 |
+
inputs=input_params, outputs=[gallery_output, output_file])
|
204 |
+
btn_open_folder.click(fn=lambda: open_folder(os.path.join(self.args.output_dir, "psd")),
|
205 |
+
inputs=None, outputs=None)
|
206 |
+
dd_input_modes.change(fn=self.on_mode_change,
|
207 |
+
inputs=[dd_input_modes],
|
208 |
+
outputs=[img_input, img_input_prompter, acc_mask_hparams])
|
209 |
+
|
210 |
self.demo.queue().launch(
|
211 |
inbrowser=self.args.inbrowser,
|
212 |
share=self.args.share,
|