KenjieDec commited on
Commit
ef928a1
1 Parent(s): 7d94dfb
Files changed (5) hide show
  1. app.py +15 -3
  2. girl.jpg +0 -0
  3. rembg/_version.py +2 -2
  4. rembg/session_base.py +1 -1
  5. rembg/session_simple.py +1 -1
app.py CHANGED
@@ -5,7 +5,7 @@ import gradio as gr
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
 
@@ -28,11 +28,23 @@ 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"), 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,
35
  article=article,
36
- examples=[['lion.png']],
37
  enable_queue=True
38
  ).launch()
 
5
  import os
6
  import cv2
7
 
8
+ def inference(file, mask, af):
9
  im = cv2.imread(file, cv2.IMREAD_COLOR)
10
  cv2.imwrite(os.path.join("input.png"), im)
11
 
 
28
 
29
  gr.Interface(
30
  inference,
31
+ [
32
+ gr.inputs.Image(type="filepath", label="Input"),
33
+ gr.inputs.Slider(10, 25, default=10, label="Alpha matting"),
34
+ gr.inputs.Radio(
35
+ [
36
+ "Default",
37
+ "Mask only"
38
+ ],
39
+ type="value",
40
+ default="Alpha matting",
41
+ label="Choices"
42
+ )
43
+ ],
44
  gr.outputs.Image(type="file", label="Output"),
45
  title=title,
46
  description=description,
47
  article=article,
48
+ examples=[["lion.png", 10, "Default"], ["girl.jpg", 10, "Default"]],
49
  enable_queue=True
50
  ).launch()
girl.jpg ADDED
rembg/_version.py CHANGED
@@ -24,8 +24,8 @@ def get_keywords():
24
  # each be defined on a line of their own. _version.py will just call
25
  # get_keywords().
26
  git_refnames = " (HEAD -> main)"
27
- git_full = "edc9fe27dff030cf6c2f29ef9a66c32d6e3f4658"
28
- git_date = "2022-11-28 08:14:19 -0300"
29
  keywords = {"refnames": git_refnames, "full": git_full, "date": git_date}
30
  return keywords
31
 
 
24
  # each be defined on a line of their own. _version.py will just call
25
  # get_keywords().
26
  git_refnames = " (HEAD -> main)"
27
+ git_full = "d62227d5866e2178e88f06074917484a4424082e"
28
+ git_date = "2022-12-10 11:51:49 -0300"
29
  keywords = {"refnames": git_refnames, "full": git_full, "date": git_date}
30
  return keywords
31
 
rembg/session_base.py CHANGED
@@ -18,7 +18,7 @@ class BaseSession:
18
  std: Tuple[float, float, float],
19
  size: Tuple[int, int],
20
  ) -> Dict[str, np.ndarray]:
21
- im = img.convert("RGB").resize(size, Image.Resampling.LANCZOS)
22
 
23
  im_ary = np.array(im)
24
  im_ary = im_ary / np.max(im_ary)
 
18
  std: Tuple[float, float, float],
19
  size: Tuple[int, int],
20
  ) -> Dict[str, np.ndarray]:
21
+ im = img.convert("RGB").resize(size, Image.LANCZOS)
22
 
23
  im_ary = np.array(im)
24
  im_ary = im_ary / np.max(im_ary)
rembg/session_simple.py CHANGED
@@ -25,6 +25,6 @@ class SimpleSession(BaseSession):
25
  pred = np.squeeze(pred)
26
 
27
  mask = Image.fromarray((pred * 255).astype("uint8"), mode="L")
28
- mask = mask.resize(img.size, Image.Resampling.LANCZOS)
29
 
30
  return [mask]
 
25
  pred = np.squeeze(pred)
26
 
27
  mask = Image.fromarray((pred * 255).astype("uint8"), mode="L")
28
+ mask = mask.resize(img.size, Image.LANCZOS)
29
 
30
  return [mask]