EF commited on
Commit
f54abe6
·
1 Parent(s): 978e396

add python package: rembg

Browse files
Files changed (4) hide show
  1. __pycache__/app.cpython-38.pyc +0 -0
  2. app.py +13 -3
  3. old.py +21 -0
  4. requirements.txt +3 -0
__pycache__/app.cpython-38.pyc ADDED
Binary file (484 Bytes). View file
 
app.py CHANGED
@@ -1,7 +1,17 @@
1
  import gradio as gr
 
 
 
2
 
3
- def greet(name):
4
- return "Hello " + name + "!!"
 
5
 
6
- iface = gr.Interface(fn=greet, inputs="text", outputs="text")
 
 
 
 
 
 
7
  iface.launch()
 
1
  import gradio as gr
2
+ from gradio.components import Image
3
+ from rembg import remove
4
+ import numpy as np
5
 
6
+ def remove_background(input_img):
7
+ output_img = remove(input_img)
8
+ return output_img
9
 
10
+
11
+ iface = gr.Interface(fn=remove_background,
12
+ inputs=gr.Image(shape=(200, 200)),
13
+ outputs="image")
14
+
15
+
16
+ # iface = gr.Interface(fn=greet, inputs="text", outputs="text")
17
  iface.launch()
old.py ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from gradio.components import Textbox, Slider, Image
3
+ from rembg import remove
4
+ import numpy as np
5
+
6
+
7
+ def remove_background(input_img):
8
+ output_img = remove(input_img)
9
+ return output_img
10
+
11
+ with gr.Blocks(theme=gr.themes.Soft()) as demo:
12
+ gr.Interface(remove_background,
13
+ gr.Image(shape=(200, 200)),
14
+ "image",
15
+ # title='Ultrasound Analysis: Background Removal',
16
+ # description='Demo'
17
+ )
18
+
19
+ # demo.launch()
20
+ demo.launch(share=True)
21
+
requirements.txt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ # Background remover
2
+ # https://pypi.org/project/rembg/
3
+ rembg==2.0.50