dooraven commited on
Commit
f1387fb
1 Parent(s): 3e30695
Files changed (1) hide show
  1. app.py +6 -3
app.py CHANGED
@@ -11,6 +11,8 @@ from point_e.diffusion.configs import DIFFUSION_CONFIGS, diffusion_from_config
11
  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
 
15
  from diffusers import StableDiffusionPipeline
16
 
@@ -117,7 +119,7 @@ def generate_3D(input, model_name='base1B', guidance_scale=3.0, grid_size=128):
117
  set_state('Converting to mesh...')
118
 
119
  uniqid = uuid.uuid4()
120
- file_path = f'/tmp/mesh-{uniqid}.npy'
121
  save_ply(pc, file_path)
122
 
123
  set_state('')
@@ -148,10 +150,10 @@ def ply_to_glb(ply_file, glb_file):
148
 
149
  return glb_file
150
 
151
- def save_plz(pc, file_name):
152
  # Produce a mesh (with vertex colors)
153
  with open(file_name, 'wb') as f:
154
- np.save(f, pc.coords)
155
 
156
 
157
  def create_gif(pc):
@@ -219,6 +221,7 @@ with block:
219
  Based on the <a href="https://github.com/openai/point-e">Point-E</a> implementation
220
  </p>
221
  <br />
 
222
  </div>
223
  ''')
224
  else:
 
11
  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.ply_util import write_ply
16
 
17
  from diffusers import StableDiffusionPipeline
18
 
 
119
  set_state('Converting to mesh...')
120
 
121
  uniqid = uuid.uuid4()
122
+ file_path = f'/tmp/mesh-{uniqid}.ply'
123
  save_ply(pc, file_path)
124
 
125
  set_state('')
 
150
 
151
  return glb_file
152
 
153
+ def save_ply(pc, file_name):
154
  # Produce a mesh (with vertex colors)
155
  with open(file_name, 'wb') as f:
156
+ pc.write_ply(f)
157
 
158
 
159
  def create_gif(pc):
 
221
  Based on the <a href="https://github.com/openai/point-e">Point-E</a> implementation
222
  </p>
223
  <br />
224
+ <p>There's only one step left before you can train your model: <a href="https://huggingface.co/spaces/{os.environ['SPACE_ID']}/settings" style="text-decoration: underline" target="_blank">attribute a <b>T4 GPU</b> to it (via the Settings tab)</a> and run the training below. Other GPUs are not compatible for now. You will be billed by the minute from when you activate the GPU until when it is turned it off.</p>
225
  </div>
226
  ''')
227
  else: