dooraven commited on
Commit
350c681
1 Parent(s): f93920b
Files changed (1) hide show
  1. app.py +7 -3
app.py CHANGED
@@ -17,6 +17,7 @@ from point_e.util.ply_util import write_ply
17
  from diffusers import StableDiffusionPipeline
18
 
19
  import trimesh
 
20
 
21
 
22
  state = ""
@@ -116,11 +117,14 @@ def generate_3D(input, model_name='base1B', guidance_scale=3.0, grid_size=128):
116
  pc = sampler.output_to_point_clouds(samples)[0]
117
 
118
  set_state('Converting to mesh...')
119
- save_ply(pc, '/tmp/mesh.ply')
 
 
 
120
 
121
  set_state('')
122
 
123
- return '/tmp/mesh.ply', create_gif(pc), gr.update(value=['/tmp/mesh.ply'], visible=True)
124
 
125
  def prepare_img(img):
126
 
@@ -146,7 +150,7 @@ def ply_to_glb(ply_file, glb_file):
146
 
147
  def save_ply(pc, file_name):
148
  # Produce a mesh (with vertex colors)
149
- with open('mesh.ply', 'wb') as f:
150
  pc.write_ply(f)
151
 
152
 
 
17
  from diffusers import StableDiffusionPipeline
18
 
19
  import trimesh
20
+ import uuid
21
 
22
 
23
  state = ""
 
117
  pc = sampler.output_to_point_clouds(samples)[0]
118
 
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=['/tmp/mesh.ply'], visible=True)
128
 
129
  def prepare_img(img):
130
 
 
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