Spaces:
Sleeping
Sleeping
aryrk
commited on
Commit
·
b8a1b3c
1
Parent(s):
220be7c
[feat] make a preprocess an option
Browse files
app.py
CHANGED
|
@@ -80,16 +80,23 @@ sample_images = [
|
|
| 80 |
if file.endswith((".jpg", ".jpeg", ".png"))
|
| 81 |
]
|
| 82 |
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 93 |
|
| 94 |
if __name__ == "__main__":
|
| 95 |
-
|
|
|
|
| 80 |
if file.endswith((".jpg", ".jpeg", ".png"))
|
| 81 |
]
|
| 82 |
|
| 83 |
+
preprocess_options = [
|
| 84 |
+
"resize_and_crop", "crop", "scale_width", "scale_width_and_crop", "none"
|
| 85 |
+
]
|
| 86 |
+
|
| 87 |
+
iface = gr.Interface(
|
| 88 |
+
fn=reflection_removal,
|
| 89 |
+
inputs=[
|
| 90 |
+
gr.Image(type="filepath", label="Upload Image (JPG/PNG)"),
|
| 91 |
+
gr.Dropdown(choices=preprocess_options, label="Preprocessing Type", default="resize_and_crop")
|
| 92 |
+
],
|
| 93 |
+
outputs=gr.Gallery(label="Results after Reflection Removal"),
|
| 94 |
+
examples=[
|
| 95 |
+
os.path.join("sample_images", img) for img in os.listdir("sample_images") if img.endswith((".jpg", ".jpeg", ".png"))
|
| 96 |
+
],
|
| 97 |
+
title="Reflection Remover with Pix2Pix",
|
| 98 |
+
description="Upload images to remove reflections using a Pix2Pix model. You can also try the sample images below."
|
| 99 |
+
)
|
| 100 |
|
| 101 |
if __name__ == "__main__":
|
| 102 |
+
iface.launch()
|