Spaces:
Build error
Build error
ahmedghani
commited on
Commit
β’
807c35c
1
Parent(s):
18485c9
bug fix
Browse files- app.py +3 -10
- image_watermark_remover.py +6 -6
app.py
CHANGED
@@ -55,17 +55,10 @@ with demo:
|
|
55 |
gr.Markdown("""
|
56 |
# <center>πΌοΈ Image Watermark Remover</center>
|
57 |
""")
|
58 |
-
|
59 |
-
|
60 |
-
input_image_watermark = gr.Image(label="Upload an Image", tool="sketch", type="pil", interactive=True)
|
61 |
-
with gr.Row():
|
62 |
-
with gr.Column():
|
63 |
-
pass
|
64 |
-
with gr.Column():
|
65 |
-
image_remove_btn = gr.Button("Remove Watermark", interactive=True, elem_id="remove_btn")
|
66 |
-
with gr.Column():
|
67 |
-
pass
|
68 |
output_image_clean = gr.Image(label="Output Image", interactive=True)
|
|
|
69 |
image_remove_btn.click(remove_image_watermark, inputs=[input_image_watermark], outputs=[output_image_clean])
|
70 |
|
71 |
with gr.Tab("Video Watermark Remover"):
|
|
|
55 |
gr.Markdown("""
|
56 |
# <center>πΌοΈ Image Watermark Remover</center>
|
57 |
""")
|
58 |
+
input_image_watermark = gr.Image(label="Upload an Image", tool="sketch", type="pil", interactive=True)
|
59 |
+
image_remove_btn = gr.Button("Remove Watermark", interactive=True, elem_id="remove_btn")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
60 |
output_image_clean = gr.Image(label="Output Image", interactive=True)
|
61 |
+
|
62 |
image_remove_btn.click(remove_image_watermark, inputs=[input_image_watermark], outputs=[output_image_clean])
|
63 |
|
64 |
with gr.Tab("Video Watermark Remover"):
|
image_watermark_remover.py
CHANGED
@@ -3,14 +3,14 @@ import requests
|
|
3 |
from PIL import Image
|
4 |
|
5 |
def remove_image_watermark(input):
|
6 |
-
image = input["image"]
|
7 |
-
mask = input["mask"]
|
8 |
image_data = io.BytesIO()
|
9 |
-
image.save(image_data, format=
|
10 |
image_data = image_data.getvalue()
|
11 |
|
12 |
mask_data = io.BytesIO()
|
13 |
-
mask.save(mask_data, format=
|
14 |
mask_data = mask_data.getvalue()
|
15 |
|
16 |
# Prepare form data
|
@@ -48,8 +48,8 @@ def remove_image_watermark(input):
|
|
48 |
}
|
49 |
|
50 |
files_data = {
|
51 |
-
'image': ('image.
|
52 |
-
'mask': ('mask.
|
53 |
}
|
54 |
|
55 |
response = requests.post('https://ahmedghani-lama-cleaner-lama.hf.space/inpaint', data=form_data, files=files_data)
|
|
|
3 |
from PIL import Image
|
4 |
|
5 |
def remove_image_watermark(input):
|
6 |
+
image = input["image"].convert("RGB")
|
7 |
+
mask = input["mask"].convert("RGB")
|
8 |
image_data = io.BytesIO()
|
9 |
+
image.save(image_data, format="JPEG")
|
10 |
image_data = image_data.getvalue()
|
11 |
|
12 |
mask_data = io.BytesIO()
|
13 |
+
mask.save(mask_data, format="JPEG")
|
14 |
mask_data = mask_data.getvalue()
|
15 |
|
16 |
# Prepare form data
|
|
|
48 |
}
|
49 |
|
50 |
files_data = {
|
51 |
+
'image': ('image.jpg', image_data),
|
52 |
+
'mask': ('mask.jpg', mask_data),
|
53 |
}
|
54 |
|
55 |
response = requests.post('https://ahmedghani-lama-cleaner-lama.hf.space/inpaint', data=form_data, files=files_data)
|