Spaces:
Sleeping
Sleeping
update
Browse files- app.py +8 -9
- examples/00047689.jpg +0 -0
- examples/00047689.webp +0 -0
- examples/00047689_mask.jpg +0 -0
- examples/00207245.jpg +0 -0
- examples/00207245.webp +0 -0
- examples/00207245_mask.jpg +0 -0
- examples/street.jpg +0 -0
- examples/street_mask.jpg +0 -0
- links.html +4 -0
app.py
CHANGED
@@ -38,7 +38,7 @@ def process_images(image, image2=None,inpaint_radius=3,blur_radius=25,edge_expan
|
|
38 |
raise gr.Error(f"image size({img_width},{img_height}) must be same as mask size({mask_width},{mask_height})")
|
39 |
else:
|
40 |
pass
|
41 |
-
print("size ok")
|
42 |
|
43 |
output = opencvinpaint.process_cvinpaint(image["background"],mask,inpaint_radius,blur_radius,edge_expand,inpaint_mode)
|
44 |
|
@@ -70,6 +70,7 @@ css="""
|
|
70 |
with gr.Blocks(css=css, elem_id="demo-container") as demo:
|
71 |
with gr.Column():
|
72 |
gr.HTML(read_file("demo_header.html"))
|
|
|
73 |
with gr.Row():
|
74 |
with gr.Column():
|
75 |
image = gr.ImageEditor(height=800,sources=['upload','clipboard'],transforms=[],image_mode='RGB', layers=False, elem_id="image_upload", type="pil", label="Upload",brush=gr.Brush(colors=["#fff"], color_mode="fixed"))
|
@@ -86,25 +87,23 @@ with gr.Blocks(css=css, elem_id="demo-container") as demo:
|
|
86 |
modes = ["Telea", "Navier-Stokes"]
|
87 |
inpaint_mode = gr.Dropdown(label="modes", choices=modes, value="Telea")
|
88 |
with gr.Column():
|
89 |
-
image_out = gr.Image(
|
90 |
-
mask_out = gr.Image(
|
91 |
|
92 |
|
93 |
|
94 |
btn.click(fn=process_images, inputs=[image, image_mask,inpaint_radius,blur_radius,edge_expand,inpaint_mode], outputs =[image_out,mask_out], api_name='infer')
|
95 |
gr.Examples(
|
96 |
-
examples=[["examples/
|
|
|
97 |
,
|
98 |
#fn=predict,
|
99 |
-
inputs=[image,image_mask],
|
100 |
cache_examples=False,
|
101 |
)
|
102 |
gr.HTML(
|
103 |
"""
|
104 |
-
|
105 |
-
<p>Inpaint Code <a href="https://github.com/opencv/opencv/blob/da3debda6d233af90e421e95700c63fc08b83b75/samples/python/inpaint.py" style="text-decoration: underline;" target="_blank">OpenCV inpaint example</a> - Gradio Demo by 🤗 Hugging Face
|
106 |
-
</p>
|
107 |
-
</div>
|
108 |
"""
|
109 |
)
|
110 |
|
|
|
38 |
raise gr.Error(f"image size({img_width},{img_height}) must be same as mask size({mask_width},{mask_height})")
|
39 |
else:
|
40 |
pass
|
41 |
+
#print("size ok")
|
42 |
|
43 |
output = opencvinpaint.process_cvinpaint(image["background"],mask,inpaint_radius,blur_radius,edge_expand,inpaint_mode)
|
44 |
|
|
|
70 |
with gr.Blocks(css=css, elem_id="demo-container") as demo:
|
71 |
with gr.Column():
|
72 |
gr.HTML(read_file("demo_header.html"))
|
73 |
+
gr.HTML(read_file("links.html"))
|
74 |
with gr.Row():
|
75 |
with gr.Column():
|
76 |
image = gr.ImageEditor(height=800,sources=['upload','clipboard'],transforms=[],image_mode='RGB', layers=False, elem_id="image_upload", type="pil", label="Upload",brush=gr.Brush(colors=["#fff"], color_mode="fixed"))
|
|
|
87 |
modes = ["Telea", "Navier-Stokes"]
|
88 |
inpaint_mode = gr.Dropdown(label="modes", choices=modes, value="Telea")
|
89 |
with gr.Column():
|
90 |
+
image_out = gr.Image(sources=[],label="Output", elem_id="output-img")
|
91 |
+
mask_out = gr.Image(sources=[],label="Mask", elem_id="mask-img",format="jpeg")
|
92 |
|
93 |
|
94 |
|
95 |
btn.click(fn=process_images, inputs=[image, image_mask,inpaint_radius,blur_radius,edge_expand,inpaint_mode], outputs =[image_out,mask_out], api_name='infer')
|
96 |
gr.Examples(
|
97 |
+
examples=[["examples/00207245.jpg", "examples/00207245_mask.jpg","examples/00207245.webp"],
|
98 |
+
["examples/00047689.jpg", "examples/00047689_mask.jpg","examples/00047689.webp"]]
|
99 |
,
|
100 |
#fn=predict,
|
101 |
+
inputs=[image,image_mask,image_out],
|
102 |
cache_examples=False,
|
103 |
)
|
104 |
gr.HTML(
|
105 |
"""
|
106 |
+
<a href="https://opencv.org/">OpenCV Official</a>
|
|
|
|
|
|
|
107 |
"""
|
108 |
)
|
109 |
|
examples/00047689.jpg
ADDED
examples/00047689.webp
ADDED
examples/00047689_mask.jpg
ADDED
examples/00207245.jpg
ADDED
examples/00207245.webp
ADDED
examples/00207245_mask.jpg
ADDED
examples/street.jpg
DELETED
Binary file (66.3 kB)
|
|
examples/street_mask.jpg
DELETED
Binary file (12 kB)
|
|
links.html
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div style="text-align: center;">
|
2 |
+
<p><a href="https://huggingface.co/spaces/Akjava/godot-huggingface-chain">AI Diagram Chat with Voice/Face Character Making Tools</a></p>
|
3 |
+
<p><a href="https://huggingface.co/spaces/Akjava/WebPTalkHead">[WebP-3F-TH]</a> <a href="https://huggingface.co/spaces/Akjava/flux1-schnell-mask-inpaint">[Flux1-Inpaint]</a> <a href="https://huggingface.co/spaces/Akjava/OpenCVInpaintCPU">[OpenCV-Inapint]</a></p>
|
4 |
+
</div>
|