KenjieDec commited on
Commit
97992b6
1 Parent(s): 87c57a3
Files changed (2) hide show
  1. app.py +3 -3
  2. lion.png +0 -0
app.py CHANGED
@@ -5,7 +5,7 @@ import gradio as gr
5
  import os
6
  import cv2
7
 
8
- def inference(file):
9
  im = cv2.imread(file, cv2.IMREAD_COLOR)
10
  cv2.imwrite(os.path.join("input.png"), im)
11
 
@@ -17,7 +17,7 @@ def inference(file):
17
  with open(input_path, 'rb') as i:
18
  with open(output_path, 'wb') as o:
19
  input = i.read()
20
- output = remove(input)
21
  o.write(output)
22
  return os.path.join("output.png")
23
 
@@ -28,7 +28,7 @@ article = "<p style='text-align: center;'><a href='https://github.com/danielgati
28
 
29
  gr.Interface(
30
  inference,
31
- [gr.inputs.Image(type="filepath", label="Input")],
32
  gr.outputs.Image(type="file", label="Output"),
33
  title=title,
34
  description=description,
 
5
  import os
6
  import cv2
7
 
8
+ def inference(file, af, mask):
9
  im = cv2.imread(file, cv2.IMREAD_COLOR)
10
  cv2.imwrite(os.path.join("input.png"), im)
11
 
 
17
  with open(input_path, 'rb') as i:
18
  with open(output_path, 'wb') as o:
19
  input = i.read()
20
+ output = remove(input, alpha_matting_erode_size = af, only_mask = (True if mask == "Mask only" else False))
21
  o.write(output)
22
  return os.path.join("output.png")
23
 
 
28
 
29
  gr.Interface(
30
  inference,
31
+ [gr.inputs.Image(type="filepath", label="Input"), gr.Slider(10, 25, value=10, label="Alpha matting"), gr.Radio(choices = ["Alpha matting", "Mask only"], value = "Alpha matting")],
32
  gr.outputs.Image(type="file", label="Output"),
33
  title=title,
34
  description=description,
lion.png ADDED