Spaces:
Sleeping
Sleeping
ui change
Browse files- .gitignore +4 -1
- app.py +2 -8
.gitignore
CHANGED
@@ -1 +1,4 @@
|
|
1 |
-
venv/
|
|
|
|
|
|
|
|
1 |
+
venv/
|
2 |
+
temp_input/
|
3 |
+
temp_output/
|
4 |
+
processed_images.zip
|
app.py
CHANGED
@@ -203,11 +203,6 @@ def gradio_interface(zip_file, crop_mode, bg_method, watermark, output_format, b
|
|
203 |
watermark_path = watermark.name if watermark else None
|
204 |
return process_images(zip_file.name, crop_mode, bg_method, watermark_path, output_format, bg_choice, custom_color, num_workers, progress)
|
205 |
|
206 |
-
def show_bg_choice(output_format):
|
207 |
-
if output_format == 'PNG':
|
208 |
-
return gr.update(visible=True)
|
209 |
-
return gr.update(visible=False)
|
210 |
-
|
211 |
def show_color_picker(bg_choice):
|
212 |
if bg_choice == 'custom':
|
213 |
return gr.update(visible=True)
|
@@ -227,8 +222,8 @@ with gr.Blocks() as iface:
|
|
227 |
num_workers = gr.Slider(minimum=1, maximum=16, step=1, label="Number of Workers", value=2)
|
228 |
|
229 |
with gr.Row():
|
230 |
-
bg_method = gr.Radio(choices=["bria", "rembg"], label="Background Removal Method", value="bria"
|
231 |
-
bg_choice = gr.Radio(choices=["transparent", "white", "custom"], label="Background Choice", value="transparent"
|
232 |
custom_color = gr.ColorPicker(label="Custom Background Color", value="#ffffff", visible=False)
|
233 |
|
234 |
with gr.Row():
|
@@ -239,7 +234,6 @@ with gr.Blocks() as iface:
|
|
239 |
processing_time = gr.Textbox(label="Processing Time (seconds)")
|
240 |
|
241 |
bg_choice.change(show_color_picker, inputs=bg_choice, outputs=custom_color)
|
242 |
-
output_format.change(show_bg_choice, inputs=output_format, outputs=bg_choice)
|
243 |
|
244 |
def process(zip_file, crop_mode, bg_method, watermark, output_format, bg_choice, custom_color, num_workers):
|
245 |
original_images, processed_images, zip_path, time_taken = gradio_interface(zip_file, crop_mode, bg_method, watermark, output_format, bg_choice, custom_color, num_workers)
|
|
|
203 |
watermark_path = watermark.name if watermark else None
|
204 |
return process_images(zip_file.name, crop_mode, bg_method, watermark_path, output_format, bg_choice, custom_color, num_workers, progress)
|
205 |
|
|
|
|
|
|
|
|
|
|
|
206 |
def show_color_picker(bg_choice):
|
207 |
if bg_choice == 'custom':
|
208 |
return gr.update(visible=True)
|
|
|
222 |
num_workers = gr.Slider(minimum=1, maximum=16, step=1, label="Number of Workers", value=2)
|
223 |
|
224 |
with gr.Row():
|
225 |
+
bg_method = gr.Radio(choices=["bria", "rembg"], label="Background Removal Method", value="bria")
|
226 |
+
bg_choice = gr.Radio(choices=["transparent", "white", "custom"], label="Background Choice", value="transparent")
|
227 |
custom_color = gr.ColorPicker(label="Custom Background Color", value="#ffffff", visible=False)
|
228 |
|
229 |
with gr.Row():
|
|
|
234 |
processing_time = gr.Textbox(label="Processing Time (seconds)")
|
235 |
|
236 |
bg_choice.change(show_color_picker, inputs=bg_choice, outputs=custom_color)
|
|
|
237 |
|
238 |
def process(zip_file, crop_mode, bg_method, watermark, output_format, bg_choice, custom_color, num_workers):
|
239 |
original_images, processed_images, zip_path, time_taken = gradio_interface(zip_file, crop_mode, bg_method, watermark, output_format, bg_choice, custom_color, num_workers)
|