Spaces:
Sleeping
Sleeping
update
Browse files- app.py +19 -7
- demo_footer.html +3 -0
- demo_header.html +10 -1
- opencvinpaint.py +1 -1
- links.html → tools.html +9 -1
app.py
CHANGED
@@ -15,7 +15,7 @@ def sanitize_prompt(prompt):
|
|
15 |
#@spaces.GPU(duration=120)
|
16 |
def process_images(image, image2=None,inpaint_radius=3,blur_radius=25,edge_expand=8,inpaint_mode="Telea",progress=gr.Progress(track_tqdm=True)):
|
17 |
progress(0, desc="Start Inpainting")
|
18 |
-
print("process_images")
|
19 |
# I'm not sure when this happen
|
20 |
if not isinstance(image, dict):
|
21 |
if image2 == None:
|
@@ -63,6 +63,22 @@ css="""
|
|
63 |
margin: 0 auto;
|
64 |
max-width: 640px;
|
65 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
66 |
"""
|
67 |
|
68 |
#css=css,
|
@@ -70,7 +86,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 |
-
gr.HTML(read_file("
|
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"))
|
@@ -101,10 +117,6 @@ with gr.Blocks(css=css, elem_id="demo-container") as demo:
|
|
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 |
|
110 |
demo.launch()
|
|
|
15 |
#@spaces.GPU(duration=120)
|
16 |
def process_images(image, image2=None,inpaint_radius=3,blur_radius=25,edge_expand=8,inpaint_mode="Telea",progress=gr.Progress(track_tqdm=True)):
|
17 |
progress(0, desc="Start Inpainting")
|
18 |
+
#print("process_images")
|
19 |
# I'm not sure when this happen
|
20 |
if not isinstance(image, dict):
|
21 |
if image2 == None:
|
|
|
63 |
margin: 0 auto;
|
64 |
max-width: 640px;
|
65 |
}
|
66 |
+
.grid-container {
|
67 |
+
display: flex;
|
68 |
+
align-items: center;
|
69 |
+
justify-content: center;
|
70 |
+
gap:10px
|
71 |
+
}
|
72 |
+
|
73 |
+
.image {
|
74 |
+
width: 128px;
|
75 |
+
height: 128px;
|
76 |
+
object-fit: cover;
|
77 |
+
}
|
78 |
+
|
79 |
+
.text {
|
80 |
+
font-size: 16px;
|
81 |
+
}
|
82 |
"""
|
83 |
|
84 |
#css=css,
|
|
|
86 |
with gr.Blocks(css=css, elem_id="demo-container") as demo:
|
87 |
with gr.Column():
|
88 |
gr.HTML(read_file("demo_header.html"))
|
89 |
+
gr.HTML(read_file("tools.html"))
|
90 |
with gr.Row():
|
91 |
with gr.Column():
|
92 |
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"))
|
|
|
117 |
inputs=[image,image_mask,image_out],
|
118 |
cache_examples=False,
|
119 |
)
|
120 |
+
gr.HTML(read_file("demo_footer.html"))
|
|
|
|
|
|
|
|
|
121 |
|
122 |
demo.launch()
|
demo_footer.html
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
<div>
|
2 |
+
<P> Images are generated with <a href="https://huggingface.co/black-forest-labs/FLUX.1-schnell">FLUX.1-schnell</a> and licensed under <a href="http://www.apache.org/licenses/LICENSE-2.0">the Apache 2.0 License</a>
|
3 |
+
</div>
|
demo_header.html
CHANGED
@@ -2,5 +2,14 @@
|
|
2 |
<h1>
|
3 |
OpenCV Inpaint(Traditional Style Inapint) CPU
|
4 |
</h1>
|
5 |
-
<
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
</div>
|
|
|
2 |
<h1>
|
3 |
OpenCV Inpaint(Traditional Style Inapint) CPU
|
4 |
</h1>
|
5 |
+
<div class="grid-container">
|
6 |
+
<img src="https://akjava.github.io/AIDiagramChatWithVoice-FaceCharacter/webp/128/00191245_09_00002200.webp" alt="Flux.1-schnell-WebP3Frame-TalkingAnimation" class="image">
|
7 |
+
|
8 |
+
<p class="text">This is traditional <a href="https://opencv.org/">OpenCV</a> Inpainting, <br>
|
9 |
+
but even when using new Inpainting techniques, it's sometimes better to clean up the background.<br>
|
10 |
+
sometime you need draw inpaint border with some paint tools<br>
|
11 |
+
usually this result is good guide for flux.1 inpainat/img2img
|
12 |
+
</p>
|
13 |
+
</div>
|
14 |
+
|
15 |
</div>
|
opencvinpaint.py
CHANGED
@@ -44,7 +44,7 @@ def blend_rgb_images(image1: np.ndarray, image2: np.ndarray, mask: np.ndarray) -
|
|
44 |
return blended.astype(np.uint8)
|
45 |
|
46 |
def process_cvinpaint(image,mask_image,inpaint_radius,blur_radius,edge_expand,inpaint_mode):
|
47 |
-
print("process cvinpaint")
|
48 |
#print(blur_radius,",",edge_expand)
|
49 |
cv_image = pil_to_cv(image)
|
50 |
|
|
|
44 |
return blended.astype(np.uint8)
|
45 |
|
46 |
def process_cvinpaint(image,mask_image,inpaint_radius,blur_radius,edge_expand,inpaint_mode):
|
47 |
+
#print("process cvinpaint")
|
48 |
#print(blur_radius,",",edge_expand)
|
49 |
cv_image = pil_to_cv(image)
|
50 |
|
links.html → tools.html
RENAMED
@@ -1,4 +1,12 @@
|
|
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>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
</div>
|
|
|
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>
|
4 |
+
<a href="https://huggingface.co/spaces/Akjava/flux1-schnell-mask-inpaint">[Flux1-Inpaint(GPU)]</a>
|
5 |
+
<a href="https://huggingface.co/spaces/Akjava/OpenCVInpaintCPU">[OpenCV-Inapint]</a>
|
6 |
+
<a href="https://huggingface.co/spaces/Akjava/Simple-Whitebalance-Image">[Whitebalance]</a>
|
7 |
+
<a href="https://huggingface.co/spaces/Akjava/Simple-Mask-Paste-Image">[Paste Image]</a>
|
8 |
+
<a href=" https://huggingface.co/spaces/Akjava/WebP-Resize-Convert">[WebP Resize Convert]</a></p>
|
9 |
+
|
10 |
+
|
11 |
+
|
12 |
</div>
|