Spaces:
Sleeping
Sleeping
mouse hover, theme
Browse files
app.py
CHANGED
@@ -6,6 +6,7 @@ import numpy as np
|
|
6 |
from PIL import Image
|
7 |
import tensorflow as tf
|
8 |
from transformers import SegformerFeatureExtractor, TFSegformerForSemanticSegmentation
|
|
|
9 |
|
10 |
feature_extractor = SegformerFeatureExtractor.from_pretrained(
|
11 |
"nielsr/segformer-b0-finetuned-segments-sidewalk",
|
@@ -116,7 +117,8 @@ def sepia(input_img):
|
|
116 |
pred_img = np.array(input_img) * 0.5 + color_seg * 0.5
|
117 |
pred_img = pred_img.astype(np.uint8)
|
118 |
|
119 |
-
fig = draw_plot(pred_img, seg)
|
|
|
120 |
return fig
|
121 |
|
122 |
demo = gr.Interface(fn=sepia,
|
@@ -126,7 +128,8 @@ demo = gr.Interface(fn=sepia,
|
|
126 |
outputs=['plot'],
|
127 |
examples=["sidewalk_1.jpg", "sidewalk_2.jpg", "sidewalk_3.jpg", "sidewalk_4.jpg", "sidewalk_5.jpg"],
|
128 |
allow_flagging='never',
|
129 |
-
theme="
|
|
|
130 |
|
131 |
|
132 |
demo.launch()
|
|
|
6 |
from PIL import Image
|
7 |
import tensorflow as tf
|
8 |
from transformers import SegformerFeatureExtractor, TFSegformerForSemanticSegmentation
|
9 |
+
import mplcursors # mouse hover
|
10 |
|
11 |
feature_extractor = SegformerFeatureExtractor.from_pretrained(
|
12 |
"nielsr/segformer-b0-finetuned-segments-sidewalk",
|
|
|
117 |
pred_img = np.array(input_img) * 0.5 + color_seg * 0.5
|
118 |
pred_img = pred_img.astype(np.uint8)
|
119 |
|
120 |
+
fig, ax = draw_plot(pred_img, seg)
|
121 |
+
mplcursors.cursor(hover=True, ax=ax)
|
122 |
return fig
|
123 |
|
124 |
demo = gr.Interface(fn=sepia,
|
|
|
128 |
outputs=['plot'],
|
129 |
examples=["sidewalk_1.jpg", "sidewalk_2.jpg", "sidewalk_3.jpg", "sidewalk_4.jpg", "sidewalk_5.jpg"],
|
130 |
allow_flagging='never',
|
131 |
+
theme="gradio/soft",
|
132 |
+
live=True)
|
133 |
|
134 |
|
135 |
demo.launch()
|