try with only one example
Browse files
app.py
CHANGED
|
@@ -84,7 +84,7 @@ def remove_background(input_image, bg_color, model_choice, alpha_matting, post_p
|
|
| 84 |
# Save the output image to a temporary file
|
| 85 |
# Generate a unique timestamp for the output file name
|
| 86 |
timestamp = time.strftime("%Y%m%d-%H%M%S")
|
| 87 |
-
output_path = f"
|
| 88 |
output_image.save(output_path)
|
| 89 |
logging.info(f"Saved output image {output_path}")
|
| 90 |
|
|
@@ -95,9 +95,8 @@ def remove_background(input_image, bg_color, model_choice, alpha_matting, post_p
|
|
| 95 |
return None, None
|
| 96 |
|
| 97 |
examples = [
|
| 98 |
-
|
| 99 |
-
['
|
| 100 |
-
['dogs.png', None, "", False, False, False]
|
| 101 |
]
|
| 102 |
# Gradio interface
|
| 103 |
iface = gr.Interface(
|
|
@@ -112,7 +111,7 @@ iface = gr.Interface(
|
|
| 112 |
type="value"
|
| 113 |
),
|
| 114 |
gr.Checkbox(label="Enable Alpha Matting", value=False),
|
| 115 |
-
gr.Checkbox(label="Post-Process Mask (
|
| 116 |
gr.Checkbox(label="Only Return Mask ", value=False)
|
| 117 |
],
|
| 118 |
outputs=[
|
|
|
|
| 84 |
# Save the output image to a temporary file
|
| 85 |
# Generate a unique timestamp for the output file name
|
| 86 |
timestamp = time.strftime("%Y%m%d-%H%M%S")
|
| 87 |
+
output_path = f"output_remove_background_{timestamp}.png"
|
| 88 |
output_image.save(output_path)
|
| 89 |
logging.info(f"Saved output image {output_path}")
|
| 90 |
|
|
|
|
| 95 |
return None, None
|
| 96 |
|
| 97 |
examples = [
|
| 98 |
+
|
| 99 |
+
['dogs.png']
|
|
|
|
| 100 |
]
|
| 101 |
# Gradio interface
|
| 102 |
iface = gr.Interface(
|
|
|
|
| 111 |
type="value"
|
| 112 |
),
|
| 113 |
gr.Checkbox(label="Enable Alpha Matting", value=False),
|
| 114 |
+
gr.Checkbox(label="Post-Process Mask (post process the mask to get better results)", value=False),
|
| 115 |
gr.Checkbox(label="Only Return Mask ", value=False)
|
| 116 |
],
|
| 117 |
outputs=[
|