sanghyun-lee commited on
Commit
34018e0
1 Parent(s): 80a08bd
Files changed (3) hide show
  1. app.py +23 -0
  2. latest.pth +3 -0
  3. requirements.txt +8 -0
app.py ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from transparent_background import Remover
3
+
4
+ # Load model
5
+ remover = Remover() # default setting
6
+ remover = Remover(mode='fast', jit=True, device='cpu', ckpt='latest.pth') # custom setting
7
+ remover = Remover(mode='base-nightly') # nightly release checkpoint
8
+
9
+
10
+ def run(inp_image, sod_type):
11
+ return remover.process(inp_image.convert("RGB"), type=sod_type)
12
+
13
+
14
+ with gr.Blocks() as demo:
15
+ with gr.Row():
16
+ inp_image = gr.Image(type="pil")
17
+ res_image = gr.Image(type="pil")
18
+ sod_type = gr.Radio(["rgba", "map", "green", "white", "blur", "overlay"], value="rgba")
19
+ submit_btn = gr.Button(value="Submit")
20
+ submit_btn.click(run, inputs=[inp_image, sod_type], outputs=[res_image])
21
+
22
+ if __name__ == "__main__":
23
+ demo.launch(debug=False, server_name="0.0.0.0", server_port=8189)
latest.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:86b896ce80988f5cae1a401746e621c8389e177e03c667e2ad493c1f84b8dbd4
3
+ size 367520613
requirements.txt ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ torch==2.1.2
2
+ torchvision==0.16.2
3
+ opencv-python==4.9.0.80
4
+ timm==0.9.12
5
+ tqdm==4.66.1
6
+ kornia==0.7.1
7
+ gdown==4.7.1
8
+ transparent-background==1.2.12