Spaces:
Sleeping
Sleeping
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from transformers import pipeline
|
| 2 |
+
image_path = "https://farm5.staticflickr.com/4007/4322154488_997e69e4cf_z.jpg"
|
| 3 |
+
pipe = pipeline("image-segmentation", model="briaai/RMBG-1.4", trust_remote_code=True)
|
| 4 |
+
pillow_mask = pipe(img_path, return_mask = True) # outputs a pillow mask
|
| 5 |
+
pillow_image = pipe(image_path) # applies mask on input and returns a pillow image
|