Spaces:
Sleeping
Sleeping
deploy_4
Browse files
app.py
CHANGED
|
@@ -381,6 +381,8 @@ def process_single_image(image_path, output_folder, bg_method, canvas_size_name,
|
|
| 381 |
image_with_no_bg = remove_background_rembg(image_path)
|
| 382 |
elif bg_method == 'bria':
|
| 383 |
image_with_no_bg = remove_background_bria(image_path)
|
|
|
|
|
|
|
| 384 |
|
| 385 |
temp_image_path = os.path.join(output_folder, f"temp_{filename}")
|
| 386 |
image_with_no_bg.save(temp_image_path, format='PNG')
|
|
@@ -500,7 +502,7 @@ def process_images(input_files, bg_method='rembg', watermark_path=None, canvas_s
|
|
| 500 |
avg_processing_time = (avg_processing_time * idx + image_processing_time) / (idx + 1)
|
| 501 |
if result:
|
| 502 |
if watermark_path:
|
| 503 |
-
get_name = future_to_image[future].split('
|
| 504 |
get_name = remove_extension(get_name[len(get_name)-1])
|
| 505 |
twibbon_input = f'{get_name}.png' if output_format == 'PNG' else f'{get_name}.jpg'
|
| 506 |
twibbon_output_path = os.path.join(output_folder, f'result_{start_time_image}.png')
|
|
@@ -644,7 +646,7 @@ with gr.Blocks(theme="NoCrypt/miku@1.2.2") as iface:
|
|
| 644 |
num_workers = gr.Slider(minimum=1, maximum=16, step=1, label="Number of Workers", value=5)
|
| 645 |
|
| 646 |
with gr.Row():
|
| 647 |
-
bg_method = gr.Radio(choices=["bria", "rembg"], label="Background Removal Method", value="bria")
|
| 648 |
bg_choice = gr.Radio(choices=["transparent", "white", "custom"], label="Background Choice", value="white")
|
| 649 |
custom_color = gr.ColorPicker(label="Custom Background Color", value="#ffffff", visible=False)
|
| 650 |
|
|
|
|
| 381 |
image_with_no_bg = remove_background_rembg(image_path)
|
| 382 |
elif bg_method == 'bria':
|
| 383 |
image_with_no_bg = remove_background_bria(image_path)
|
| 384 |
+
elif bg_method == None:
|
| 385 |
+
image_with_no_bg = Image.open(image_path)
|
| 386 |
|
| 387 |
temp_image_path = os.path.join(output_folder, f"temp_{filename}")
|
| 388 |
image_with_no_bg.save(temp_image_path, format='PNG')
|
|
|
|
| 502 |
avg_processing_time = (avg_processing_time * idx + image_processing_time) / (idx + 1)
|
| 503 |
if result:
|
| 504 |
if watermark_path:
|
| 505 |
+
get_name = future_to_image[future].split('\\')
|
| 506 |
get_name = remove_extension(get_name[len(get_name)-1])
|
| 507 |
twibbon_input = f'{get_name}.png' if output_format == 'PNG' else f'{get_name}.jpg'
|
| 508 |
twibbon_output_path = os.path.join(output_folder, f'result_{start_time_image}.png')
|
|
|
|
| 646 |
num_workers = gr.Slider(minimum=1, maximum=16, step=1, label="Number of Workers", value=5)
|
| 647 |
|
| 648 |
with gr.Row():
|
| 649 |
+
bg_method = gr.Radio(choices=["bria", "rembg", None], label="Background Removal Method", value="bria")
|
| 650 |
bg_choice = gr.Radio(choices=["transparent", "white", "custom"], label="Background Choice", value="white")
|
| 651 |
custom_color = gr.ColorPicker(label="Custom Background Color", value="#ffffff", visible=False)
|
| 652 |
|