Spaces:
Running
on
Zero
Running
on
Zero
πwπ
Browse files- README.md +1 -0
- app.py +3 -1
- hafedh purple.jpg +0 -0
- lain with background.jpg +0 -0
- requirements.txt +3 -2
README.md
CHANGED
@@ -7,6 +7,7 @@ sdk: gradio
|
|
7 |
sdk_version: 4.18.0
|
8 |
app_file: app.py
|
9 |
pinned: false
|
|
|
10 |
---
|
11 |
|
12 |
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
7 |
sdk_version: 4.18.0
|
8 |
app_file: app.py
|
9 |
pinned: false
|
10 |
+
short_description: background removal using python and the transformers library
|
11 |
---
|
12 |
|
13 |
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
app.py
CHANGED
@@ -1,5 +1,6 @@
|
|
1 |
from transformers import pipeline
|
2 |
import gradio as gr
|
|
|
3 |
|
4 |
pipe = pipeline(
|
5 |
"image-segmentation",
|
@@ -9,6 +10,7 @@ pipe = pipeline(
|
|
9 |
)
|
10 |
|
11 |
|
|
|
12 |
def predict(image_path):
|
13 |
pipe(image_path, out_name="myout.png")
|
14 |
return "myout.png"
|
@@ -18,6 +20,6 @@ gr.Interface(
|
|
18 |
predict,
|
19 |
gr.Image(type="filepath"),
|
20 |
"image",
|
21 |
-
examples=[["./
|
22 |
cache_examples=True,
|
23 |
).launch()
|
|
|
1 |
from transformers import pipeline
|
2 |
import gradio as gr
|
3 |
+
import spaces
|
4 |
|
5 |
pipe = pipeline(
|
6 |
"image-segmentation",
|
|
|
10 |
)
|
11 |
|
12 |
|
13 |
+
@spaces.GPU
|
14 |
def predict(image_path):
|
15 |
pipe(image_path, out_name="myout.png")
|
16 |
return "myout.png"
|
|
|
20 |
predict,
|
21 |
gr.Image(type="filepath"),
|
22 |
"image",
|
23 |
+
examples=[["./hafedh purple.jpg"], ["./gigachad.webp"]],
|
24 |
cache_examples=True,
|
25 |
).launch()
|
hafedh purple.jpg
ADDED
lain with background.jpg
DELETED
Binary file (5.11 kB)
|
|
requirements.txt
CHANGED
@@ -1,5 +1,6 @@
|
|
1 |
-
torch
|
2 |
torchvision
|
3 |
transformers
|
4 |
pillow
|
5 |
-
scikit-image
|
|
|
|
1 |
+
torch==2.2.0
|
2 |
torchvision
|
3 |
transformers
|
4 |
pillow
|
5 |
+
scikit-image
|
6 |
+
spaces
|