Spaces:
Sleeping
Sleeping
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
import pixellib
|
| 3 |
+
from pixellib.torchbackend.instance import instanceSegmentation
|
| 4 |
+
|
| 5 |
+
ins = instanceSegmentation()
|
| 6 |
+
ins.load_model("https://github.com/ayoolaolafenwa/PixelLib/releases/download/0.2.0/pointrend_resnet50.pkl")
|
| 7 |
+
def seg(inp):
|
| 8 |
+
|
| 9 |
+
ins.segmentImage(f"{inp}", show_bboxes=True, output_image_name="output_image.jpg")
|
| 10 |
+
return "output_image.jpg"
|
| 11 |
+
|
| 12 |
+
gr.Interface(
|
| 13 |
+
fn=seg,
|
| 14 |
+
inputs=inp,
|
| 15 |
+
outputs=oup
|
| 16 |
+
).launch()
|