Thomas Male
commited on
Commit
·
5260df5
1
Parent(s):
db2ce80
Update handler.py
Browse files- handler.py +10 -8
handler.py
CHANGED
@@ -71,16 +71,18 @@ class EndpointHandler():
|
|
71 |
|
72 |
pc = sampler.output_to_point_clouds(samples)[0]
|
73 |
print('type of pc: ', type(pc))
|
|
|
|
|
74 |
|
75 |
data_list = pc.coords.tolist()
|
76 |
json_string = json.dumps(data_list)
|
77 |
-
|
78 |
-
#print(pc)
|
79 |
|
80 |
-
#
|
81 |
-
|
82 |
-
#image.save(buffered, format="JPEG")
|
83 |
-
#img_str = base64.b64encode(buffered.getvalue())
|
84 |
|
85 |
-
#
|
86 |
-
|
|
|
|
|
|
|
|
71 |
|
72 |
pc = sampler.output_to_point_clouds(samples)[0]
|
73 |
print('type of pc: ', type(pc))
|
74 |
+
|
75 |
+
pc_dict = {}
|
76 |
|
77 |
data_list = pc.coords.tolist()
|
78 |
json_string = json.dumps(data_list)
|
79 |
+
pc_dict['data'] = json_string
|
|
|
80 |
|
81 |
+
# Convert NumPy arrays to Python lists for serializing
|
82 |
+
serializable_channels = {key: value.tolist() for key, value in pc.channels.items()}
|
|
|
|
|
83 |
|
84 |
+
# Serialize the dictionary to a JSON-formatted string
|
85 |
+
channel_data = json.dumps(serializable_channels)
|
86 |
+
pc_dict['channels'] = channel_data
|
87 |
+
|
88 |
+
return pc_dict
|