Spaces:
Runtime error
Runtime error
Johannes
commited on
Commit
•
2815d9f
1
Parent(s):
f60e77b
stack masks
Browse files
app.py
CHANGED
@@ -47,6 +47,7 @@ with gr.Blocks() as demo:
|
|
47 |
gr.Markdown("# WildSynth: Synthetic Wildlife Data Generation")
|
48 |
gr.Markdown(
|
49 |
"""
|
|
|
50 |
### About
|
51 |
We have trained a JAX ControlNet model for semantic segmentation on Wildlife Animal Images.
|
52 |
|
@@ -73,13 +74,14 @@ with gr.Blocks() as demo:
|
|
73 |
|
74 |
def generate_mask(image):
|
75 |
outputs = generator(image, points_per_batch=256)
|
76 |
-
|
77 |
for mask in outputs["masks"]:
|
78 |
color = np.concatenate([np.random.random(3), np.array([1.0])], axis=0)
|
79 |
h, w = mask.shape[-2:]
|
80 |
mask_image = mask.reshape(h, w, 1) * color.reshape(1, 1, -1)
|
|
|
81 |
|
82 |
-
return
|
83 |
|
84 |
# predictor.set_image(image)
|
85 |
# input_point = np.array([120, 21])
|
|
|
47 |
gr.Markdown("# WildSynth: Synthetic Wildlife Data Generation")
|
48 |
gr.Markdown(
|
49 |
"""
|
50 |
+
## Work in Progress
|
51 |
### About
|
52 |
We have trained a JAX ControlNet model for semantic segmentation on Wildlife Animal Images.
|
53 |
|
|
|
74 |
|
75 |
def generate_mask(image):
|
76 |
outputs = generator(image, points_per_batch=256)
|
77 |
+
mask_images = []
|
78 |
for mask in outputs["masks"]:
|
79 |
color = np.concatenate([np.random.random(3), np.array([1.0])], axis=0)
|
80 |
h, w = mask.shape[-2:]
|
81 |
mask_image = mask.reshape(h, w, 1) * color.reshape(1, 1, -1)
|
82 |
+
mask_images.append(mask_image)
|
83 |
|
84 |
+
return np.stack(mask_images)
|
85 |
|
86 |
# predictor.set_image(image)
|
87 |
# input_point = np.array([120, 21])
|