Spaces:
Running
on
Zero
Running
on
Zero
Jagrut Thakare
commited on
Commit
·
1d45237
1
Parent(s):
3b555b3
v2.3
Browse files
app.py
CHANGED
@@ -16,7 +16,8 @@ def process_image(image, mask, progress=gr.Progress(track_tqdm=True)):
|
|
16 |
print("Mask Size : ", image["layers"][0].shape)
|
17 |
print("Unique values: ", np.unique(image["layers"][0]))
|
18 |
print("Type : ", type(image["layers"][0]))
|
19 |
-
|
|
|
20 |
else:
|
21 |
print("\nProcessing Received Mask\n")
|
22 |
print("Mask Size : ", mask.shape)
|
@@ -25,10 +26,11 @@ def process_image(image, mask, progress=gr.Progress(track_tqdm=True)):
|
|
25 |
print("Mask Size : ", mask["background"].shape)
|
26 |
print("Unique values: ", np.unique(mask["background"]))
|
27 |
print("Type : ", type(mask["background"]))
|
|
|
28 |
output = process_inpaint(image["background"], mask["background"])
|
29 |
img_output = Image.fromarray(output).convert("RGB")
|
30 |
|
31 |
-
return img_output
|
32 |
|
33 |
|
34 |
with gr.Blocks() as demo:
|
@@ -41,6 +43,7 @@ with gr.Blocks() as demo:
|
|
41 |
button = gr.Button("Remove")
|
42 |
with gr.Column():
|
43 |
output = gr.Image(format="png", label="Output Image")
|
44 |
-
|
|
|
45 |
|
46 |
demo.launch(debug=True,show_error=True)
|
|
|
16 |
print("Mask Size : ", image["layers"][0].shape)
|
17 |
print("Unique values: ", np.unique(image["layers"][0]))
|
18 |
print("Type : ", type(image["layers"][0]))
|
19 |
+
mask = image["layers"][0]
|
20 |
+
output = process_inpaint(image["background"], mask)
|
21 |
else:
|
22 |
print("\nProcessing Received Mask\n")
|
23 |
print("Mask Size : ", mask.shape)
|
|
|
26 |
print("Mask Size : ", mask["background"].shape)
|
27 |
print("Unique values: ", np.unique(mask["background"]))
|
28 |
print("Type : ", type(mask["background"]))
|
29 |
+
mask = mask["background"]
|
30 |
output = process_inpaint(image["background"], mask["background"])
|
31 |
img_output = Image.fromarray(output).convert("RGB")
|
32 |
|
33 |
+
return img_output, mask
|
34 |
|
35 |
|
36 |
with gr.Blocks() as demo:
|
|
|
43 |
button = gr.Button("Remove")
|
44 |
with gr.Column():
|
45 |
output = gr.Image(format="png", label="Output Image")
|
46 |
+
mask_out = gr.Image(format="png", label="Output Image")
|
47 |
+
button.click(fn=process_image, inputs=[image, mask], outputs=[output, mask_out])
|
48 |
|
49 |
demo.launch(debug=True,show_error=True)
|