Thomas Male
commited on
Commit
·
db2ce80
1
Parent(s):
ec8c491
Update handler.py
Browse files- handler.py +7 -1
handler.py
CHANGED
|
@@ -7,7 +7,9 @@ from point_e.diffusion.sampler import PointCloudSampler
|
|
| 7 |
from point_e.models.download import load_checkpoint
|
| 8 |
from point_e.models.configs import MODEL_CONFIGS, model_from_config
|
| 9 |
from point_e.util.plotting import plot_point_cloud
|
|
|
|
| 10 |
import base64
|
|
|
|
| 11 |
from io import BytesIO
|
| 12 |
|
| 13 |
|
|
@@ -68,7 +70,11 @@ class EndpointHandler():
|
|
| 68 |
#image = self.pipe(inputs, guidance_scale=7.5)["sample"][0]
|
| 69 |
|
| 70 |
pc = sampler.output_to_point_clouds(samples)[0]
|
| 71 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 72 |
#print(pc)
|
| 73 |
|
| 74 |
# encode image as base 64
|
|
|
|
| 7 |
from point_e.models.download import load_checkpoint
|
| 8 |
from point_e.models.configs import MODEL_CONFIGS, model_from_config
|
| 9 |
from point_e.util.plotting import plot_point_cloud
|
| 10 |
+
import json
|
| 11 |
import base64
|
| 12 |
+
import numpy as np
|
| 13 |
from io import BytesIO
|
| 14 |
|
| 15 |
|
|
|
|
| 70 |
#image = self.pipe(inputs, guidance_scale=7.5)["sample"][0]
|
| 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 |
+
return {"data": json_string}
|
| 78 |
#print(pc)
|
| 79 |
|
| 80 |
# encode image as base 64
|