dooraven commited on
Commit
02b58b6
1 Parent(s): 8ec8758
Files changed (1) hide show
  1. app.py +8 -5
app.py CHANGED
@@ -119,14 +119,12 @@ def generate_3D(input, model_name='base1B', guidance_scale=3.0, grid_size=128):
119
  set_state('Converting to mesh...')
120
 
121
  uniqid = uuid.uuid4()
122
- file_path = f'/tmp/mesh-{uniqid}.npz'
123
-
124
- print(file_path)
125
- pc.save(file_path)
126
 
127
  set_state('')
128
 
129
- return file_path, create_gif(pc), gr.update(value=['/tmp/mesh.ply'], visible=True)
130
 
131
  def prepare_img(img):
132
 
@@ -150,6 +148,11 @@ def ply_to_glb(ply_file, glb_file):
150
 
151
  return glb_file
152
 
 
 
 
 
 
153
 
154
  def create_gif(pc):
155
  fig = plt.figure(facecolor='black', figsize=(4, 4))
 
119
  set_state('Converting to mesh...')
120
 
121
  uniqid = uuid.uuid4()
122
+ file_path = f'/tmp/{uniqid}.ply'
123
+ save_ply(pc, file_path)
 
 
124
 
125
  set_state('')
126
 
127
+ return file_path, create_gif(pc), gr.update(value=[file_path], visible=True)
128
 
129
  def prepare_img(img):
130
 
 
148
 
149
  return glb_file
150
 
151
+ def save_ply(pc, file_name):
152
+ # Produce a mesh (with vertex colors)
153
+ with open(file_name, 'wb') as f:
154
+ pc.write_ply(f)
155
+
156
 
157
  def create_gif(pc):
158
  fig = plt.figure(facecolor='black', figsize=(4, 4))