Spaces:
Running
on
Zero
Running
on
Zero
nick_93
commited on
Commit
•
cf35ebe
1
Parent(s):
3b49dff
init
Browse files
app.py
CHANGED
@@ -78,8 +78,8 @@ def get_segmentation_pipeline(
|
|
78 |
@spaces.GPU
|
79 |
def segment_image(
|
80 |
image: Image,
|
81 |
-
|
82 |
-
|
83 |
) -> Image:
|
84 |
"""
|
85 |
Segments an image using a semantic segmentation model.
|
@@ -209,9 +209,9 @@ class ControlNetDepthDesignModelMulti:
|
|
209 |
orig_w, orig_h = empty_room_image.size
|
210 |
new_width, new_height = resize_dimensions(empty_room_image.size, img_size)
|
211 |
input_image = empty_room_image.resize((new_width, new_height))
|
212 |
-
real_seg = np.array(segment_image(input_image
|
213 |
-
|
214 |
-
|
215 |
unique_colors = np.unique(real_seg.reshape(-1, real_seg.shape[2]), axis=0)
|
216 |
unique_colors = [tuple(color) for color in unique_colors]
|
217 |
segment_items = [map_colors_rgb(i) for i in unique_colors]
|
|
|
78 |
@spaces.GPU
|
79 |
def segment_image(
|
80 |
image: Image,
|
81 |
+
image_processor: AutoImageProcessor,
|
82 |
+
image_segmentor: UperNetForSemanticSegmentation
|
83 |
) -> Image:
|
84 |
"""
|
85 |
Segments an image using a semantic segmentation model.
|
|
|
209 |
orig_w, orig_h = empty_room_image.size
|
210 |
new_width, new_height = resize_dimensions(empty_room_image.size, img_size)
|
211 |
input_image = empty_room_image.resize((new_width, new_height))
|
212 |
+
real_seg = np.array(segment_image(input_image,
|
213 |
+
seg_image_processor,
|
214 |
+
image_segmentor))
|
215 |
unique_colors = np.unique(real_seg.reshape(-1, real_seg.shape[2]), axis=0)
|
216 |
unique_colors = [tuple(color) for color in unique_colors]
|
217 |
segment_items = [map_colors_rgb(i) for i in unique_colors]
|