image-matting / app.py
szk1ck's picture
first commit
dc403f6
raw
history blame
1.57 kB
import shutil
import gradio as gr
from PIL import Image
import sys, os
from rembg import remove
def run_rembg(img):
output = remove(img)
return output
if __name__=="__main__":
with gr.Blocks() as demo:
gr.Markdown(
"""
<center><h1>Image Matting using U<sup>2</sup>-Net</h1></center>
"""
)
with gr.Row():
with gr.Column():
gr.Markdown(
"""
Input Image
"""
)
image_input = gr.Image(type="numpy", label=" ")
with gr.Column():
gr.Markdown(
"""
Output Image
"""
)
image_output = gr.Image(type="numpy", label=" ")
btn = gr.Button("Run!")
btn.click(
fn=run_rembg,
inputs=image_input,
outputs=image_output,
api_name="imageMatting"
)
gr.Markdown(
"""
---
<b>Acknowledgments</b>
- Library
- Library Git hub : [danielgatis/rembg](https://github.com/danielgatis/rembg)
- Cloned on 2023/3/12
- Algorithm
- Library Git hub : [U<sup>2</sup>-Net](https://github.com/xuebinqin/U-2-Net)
"""
)
demo.launch(
favicon_path="./assets/ハサミのフリーアイコン.png"
)