Spaces:
Runtime error
Runtime error
wippers
Browse files
app.py
CHANGED
@@ -12,7 +12,7 @@ from point_e.diffusion.sampler import PointCloudSampler
|
|
12 |
from point_e.models.download import load_checkpoint
|
13 |
from point_e.models.configs import MODEL_CONFIGS, model_from_config
|
14 |
from point_e.util.plotting import plot_point_cloud
|
15 |
-
from point_e.util.
|
16 |
|
17 |
from diffusers import StableDiffusionPipeline
|
18 |
|
@@ -145,26 +145,10 @@ def ply_to_glb(ply_file, glb_file):
|
|
145 |
return glb_file
|
146 |
|
147 |
def save_ply(pc, file_name, grid_size):
|
148 |
-
set_state('Creating SDF model...')
|
149 |
-
sdf_name = 'sdf'
|
150 |
-
sdf_model = model_from_config(MODEL_CONFIGS[sdf_name], device)
|
151 |
-
sdf_model.eval()
|
152 |
-
|
153 |
-
set_state('Loading SDF model...')
|
154 |
-
sdf_model.load_state_dict(load_checkpoint(sdf_name, device))
|
155 |
-
|
156 |
# Produce a mesh (with vertex colors)
|
157 |
-
|
158 |
-
pc
|
159 |
-
|
160 |
-
batch_size=4096,
|
161 |
-
grid_size=grid_size, # increase to 128 for resolution used in evals
|
162 |
-
progress=True,
|
163 |
-
)
|
164 |
-
|
165 |
-
# Write the mesh to a PLY file to import into some other program.
|
166 |
-
with open(file_name, 'wb') as f:
|
167 |
-
mesh.write_ply(f)
|
168 |
|
169 |
def create_gif(pc):
|
170 |
fig = plt.figure(facecolor='black', figsize=(4, 4))
|
@@ -293,4 +277,4 @@ with block:
|
|
293 |
img_button.click(fn=generate_3D, inputs=[input_image, model, scale], outputs=[model_3d, model_gif, file_out])
|
294 |
text_button.click(fn=generate_3D, inputs=[prompt, model, scale], outputs=[model_3d, model_gif, file_out])
|
295 |
|
296 |
-
block.launch(show_api=
|
|
|
12 |
from point_e.models.download import load_checkpoint
|
13 |
from point_e.models.configs import MODEL_CONFIGS, model_from_config
|
14 |
from point_e.util.plotting import plot_point_cloud
|
15 |
+
from point_e.util.ply_util import ply_util
|
16 |
|
17 |
from diffusers import StableDiffusionPipeline
|
18 |
|
|
|
145 |
return glb_file
|
146 |
|
147 |
def save_ply(pc, file_name, grid_size):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
148 |
# Produce a mesh (with vertex colors)
|
149 |
+
with open(file_name, "wb") as f:
|
150 |
+
ply_util.write_ply(f, pc)
|
151 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
152 |
|
153 |
def create_gif(pc):
|
154 |
fig = plt.figure(facecolor='black', figsize=(4, 4))
|
|
|
277 |
img_button.click(fn=generate_3D, inputs=[input_image, model, scale], outputs=[model_3d, model_gif, file_out])
|
278 |
text_button.click(fn=generate_3D, inputs=[prompt, model, scale], outputs=[model_3d, model_gif, file_out])
|
279 |
|
280 |
+
block.launch(show_api=True, share=True)
|