Spaces:
Sleeping
Sleeping
Commit
·
6f8adda
1
Parent(s):
4177d86
Update app.py
Browse files
app.py
CHANGED
@@ -34,19 +34,28 @@ if __name__ == "__main__":
|
|
34 |
providers = ['CUDAExecutionProvider', 'CPUExecutionProvider']
|
35 |
model_path = huggingface_hub.hf_hub_download("skytnt/anime-seg", "isnetis.onnx")
|
36 |
rmbg_model = rt.InferenceSession(model_path, providers=providers)
|
37 |
-
app = gr.Blocks()
|
38 |
-
with app:
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
app.launch(share=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
34 |
providers = ['CUDAExecutionProvider', 'CPUExecutionProvider']
|
35 |
model_path = huggingface_hub.hf_hub_download("skytnt/anime-seg", "isnetis.onnx")
|
36 |
rmbg_model = rt.InferenceSession(model_path, providers=providers)
|
37 |
+
# app = gr.Blocks()
|
38 |
+
# with app:
|
39 |
+
# gr.Markdown("# Anime Remove Background\n\n"
|
40 |
+
# "\n\n"
|
41 |
+
# "demo for [https://github.com/SkyTNT/anime-segmentation/](https://github.com/SkyTNT/anime-segmentation/)")
|
42 |
+
# with gr.Row():
|
43 |
+
# with gr.Column():
|
44 |
+
# input_img = gr.Image(label="input image")
|
45 |
+
# examples_data = [[f"examples/{x:02d}.jpg"] for x in range(1, 4)]
|
46 |
+
# examples = gr.Dataset(components=[input_img], samples=examples_data)
|
47 |
+
# run_btn = gr.Button(variant="primary")
|
48 |
+
# output_mask = gr.Image(label="mask")
|
49 |
+
# output_img = gr.Image(label="result", image_mode="RGBA")
|
50 |
+
# examples.click(lambda x: x[0], [examples], [input_img])
|
51 |
+
# run_btn.click(rmbg_fn, [input_img], [output_mask, output_img])
|
52 |
+
# app.launch(show_api=True, show_error=True, share=True)
|
53 |
+
gr.Interface(fn=rmbg_fn,
|
54 |
+
inputs=gr.inputs.Image(label="input image"),
|
55 |
+
outputs=[gr.outputs.Image(label="mask", type="numpy", image_mode="L"),
|
56 |
+
gr.outputs.Image(label="result", type="numpy", image_mode="RGBA")],
|
57 |
+
title="Anime Remove Background",
|
58 |
+
description="demo for [https://github.com/SkyTNT/anime-segmentation/](https://github.com/SkyTNT/anime-segmentation/)",
|
59 |
+
examples=[[f"examples/{x:02d}.jpg"] for x in range(1, 4)],
|
60 |
+
).launch(show_api=True, show_error=True, share=True)
|
61 |
+
|