Spaces:
Runtime error
Runtime error
update
Browse files
app.py
CHANGED
@@ -1,8 +1,10 @@
|
|
1 |
import paddlehub as hub
|
2 |
import gradio as gr
|
3 |
|
|
|
4 |
module = hub.Module(name="lseg")
|
5 |
|
|
|
6 |
def segment(image, labels):
|
7 |
results = module.segment(
|
8 |
image=image[..., ::-1],
|
@@ -10,4 +12,10 @@ def segment(image, labels):
|
|
10 |
)
|
11 |
return [results['color'][..., ::-1], results['mix'][..., ::-1], *[v[..., ::-1] for v in results['classes'].values()]]
|
12 |
|
13 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import paddlehub as hub
|
2 |
import gradio as gr
|
3 |
|
4 |
+
|
5 |
module = hub.Module(name="lseg")
|
6 |
|
7 |
+
|
8 |
def segment(image, labels):
|
9 |
results = module.segment(
|
10 |
image=image[..., ::-1],
|
|
|
12 |
)
|
13 |
return [results['color'][..., ::-1], results['mix'][..., ::-1], *[v[..., ::-1] for v in results['classes'].values()]]
|
14 |
|
15 |
+
|
16 |
+
gr.Interface(
|
17 |
+
fn=segment,
|
18 |
+
inputs=['image', gr.Textbox(
|
19 |
+
placeholder='other\ncat', lines=5, max_lines=50)],
|
20 |
+
outputs=[gr.Gallery().style(grid=[2, 3], height="auto")]
|
21 |
+
).launch()
|