Spaces:
Runtime error
Runtime error
jens
commited on
Commit
·
129fda7
1
Parent(s):
d46e73c
fix
Browse files
app.py
CHANGED
@@ -70,10 +70,14 @@ with block:
|
|
70 |
input_image.upload(on_input_image_upload, [input_image], [raw_image, point_coords, point_labels], queue=False)
|
71 |
|
72 |
# event - set coords
|
73 |
-
def on_input_image_select(input_image, image_edit_trigger, point_coords, point_labels, point_label_radio, evt: gr.SelectData):
|
|
|
74 |
if image_edit_trigger:
|
75 |
unedited_image = input_image.copy()
|
76 |
image_edit_trigger = False
|
|
|
|
|
|
|
77 |
x, y = evt.index
|
78 |
color = red if point_label_radio == 0 else blue
|
79 |
img = np.array(input_image)
|
@@ -81,14 +85,16 @@ with block:
|
|
81 |
img = Image.fromarray(img)
|
82 |
point_coords.append([x,y])
|
83 |
point_labels.append(point_label_radio)
|
84 |
-
|
85 |
-
return
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
|
91 |
-
input_image.select(on_input_image_select,
|
|
|
|
|
92 |
|
93 |
def on_click_sam_encode_btn(inputs):
|
94 |
print("encoding")
|
@@ -109,7 +115,7 @@ with block:
|
|
109 |
|
110 |
def on_depth_reconstruction_btn_click(inputs):
|
111 |
print("depth reconstruction")
|
112 |
-
image = inputs[
|
113 |
path = dpt.generate_obj_masks(image=image, n_samples=inputs[n_samples], cube_size=inputs[cube_size], masks=inputs[masks])
|
114 |
return {pcl_figure: path}
|
115 |
depth_reconstruction_btn.click(on_depth_reconstruction_btn_click, components, [pcl_figure], queue=False)
|
|
|
70 |
input_image.upload(on_input_image_upload, [input_image], [raw_image, point_coords, point_labels], queue=False)
|
71 |
|
72 |
# event - set coords
|
73 |
+
def on_input_image_select(raw_image, input_image, image_edit_trigger, point_coords, point_labels, point_label_radio, evt: gr.SelectData):
|
74 |
+
|
75 |
if image_edit_trigger:
|
76 |
unedited_image = input_image.copy()
|
77 |
image_edit_trigger = False
|
78 |
+
else:
|
79 |
+
unedited_image = raw_image
|
80 |
+
|
81 |
x, y = evt.index
|
82 |
color = red if point_label_radio == 0 else blue
|
83 |
img = np.array(input_image)
|
|
|
85 |
img = Image.fromarray(img)
|
86 |
point_coords.append([x,y])
|
87 |
point_labels.append(point_label_radio)
|
88 |
+
|
89 |
+
return [unedited_image,
|
90 |
+
img,
|
91 |
+
point_coords,
|
92 |
+
point_labels,
|
93 |
+
image_edit_trigger]
|
94 |
|
95 |
+
input_image.select(on_input_image_select,
|
96 |
+
[raw_image, input_image, image_edit_trigger, point_coords, point_labels, point_label_radio],
|
97 |
+
[raw_image, input_image, point_coords, point_labels, image_edit_trigger], queue=False)
|
98 |
|
99 |
def on_click_sam_encode_btn(inputs):
|
100 |
print("encoding")
|
|
|
115 |
|
116 |
def on_depth_reconstruction_btn_click(inputs):
|
117 |
print("depth reconstruction")
|
118 |
+
image = inputs[raw_image]
|
119 |
path = dpt.generate_obj_masks(image=image, n_samples=inputs[n_samples], cube_size=inputs[cube_size], masks=inputs[masks])
|
120 |
return {pcl_figure: path}
|
121 |
depth_reconstruction_btn.click(on_depth_reconstruction_btn_click, components, [pcl_figure], queue=False)
|