Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -2,6 +2,7 @@ import gradio as gr
|
|
| 2 |
import pixellib
|
| 3 |
from pixellib.torchbackend.instance import instanceSegmentation
|
| 4 |
from PIL import Image
|
|
|
|
| 5 |
|
| 6 |
ins = instanceSegmentation()
|
| 7 |
ins.load_model("https://github.com/ayoolaolafenwa/PixelLib/releases/download/0.2.0/pointrend_resnet50.pkl")
|
|
@@ -20,7 +21,7 @@ def seg(inp):
|
|
| 20 |
#results, output = ins.segmentImage("image.jpg", show_bboxes=True, output_image_name="result.jpg")
|
| 21 |
print (results)
|
| 22 |
for image in results['extracted_objects']:
|
| 23 |
-
out_box.append(
|
| 24 |
return out_box
|
| 25 |
|
| 26 |
gr.Interface(
|
|
|
|
| 2 |
import pixellib
|
| 3 |
from pixellib.torchbackend.instance import instanceSegmentation
|
| 4 |
from PIL import Image
|
| 5 |
+
import cv2
|
| 6 |
|
| 7 |
ins = instanceSegmentation()
|
| 8 |
ins.load_model("https://github.com/ayoolaolafenwa/PixelLib/releases/download/0.2.0/pointrend_resnet50.pkl")
|
|
|
|
| 21 |
#results, output = ins.segmentImage("image.jpg", show_bboxes=True, output_image_name="result.jpg")
|
| 22 |
print (results)
|
| 23 |
for image in results['extracted_objects']:
|
| 24 |
+
out_box.append(cv2.cvtColor(image, cv2.COLOR_BGR2RGB))
|
| 25 |
return out_box
|
| 26 |
|
| 27 |
gr.Interface(
|