Spaces:
Runtime error
Runtime error
feat: better placeholder
Browse files- app.py +23 -4
- demo.jpeg +0 -0
- requirements.txt +1 -0
app.py
CHANGED
@@ -1,7 +1,26 @@
|
|
1 |
import gradio as gr
|
|
|
|
|
|
|
|
|
2 |
|
3 |
-
def greet(name):
|
4 |
-
return "Hello " + name + "!!"
|
5 |
|
6 |
-
|
7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import gradio as gr
|
2 |
+
import cv2
|
3 |
+
from PIL import Image
|
4 |
+
import numpy as np
|
5 |
+
from gradio import components
|
6 |
|
|
|
|
|
7 |
|
8 |
+
def segment_and_show(image):
|
9 |
+
image = cv2.cvtColor(np.array(image), cv2.COLOR_RGB2BGR)
|
10 |
+
|
11 |
+
# TODO: Implement segmentation logic here
|
12 |
+
return Image.fromarray(cv2.cvtColor(image, cv2.COLOR_BGR2RGB))
|
13 |
+
|
14 |
+
|
15 |
+
default_image = Image.open("demo.jpeg")
|
16 |
+
|
17 |
+
iface = gr.Interface(
|
18 |
+
fn=segment_and_show,
|
19 |
+
inputs=components.Image(value=default_image),
|
20 |
+
outputs=components.Image(type="pil"),
|
21 |
+
title="Urban Autonomy Instance Segmentation Demo",
|
22 |
+
description="Upload an image or use the default to see the instance segmentation model in action.",
|
23 |
+
)
|
24 |
+
|
25 |
+
if __name__ == "__main__":
|
26 |
+
iface.launch()
|
demo.jpeg
ADDED
requirements.txt
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
opencv-python
|