Surn commited on
Commit
9cb0e22
·
1 Parent(s): 0c9320c

fix temp file location

Browse files
Files changed (1) hide show
  1. app.py +7 -4
app.py CHANGED
@@ -155,7 +155,9 @@ def create_3d_obj(rgb_image, raw_depth, image_path, depth=10, z_scale=200):
155
  mesh_crop = mesh.crop(bbox)
156
 
157
  # Save the mesh as a GLTF file
158
- gltf_path = f"./models/{image_path.stem}.gltf"
 
 
159
  o3d.io.write_triangle_mesh(gltf_path, mesh_crop, write_triangle_uvs=True)
160
  return gltf_path
161
 
@@ -188,7 +190,7 @@ z_scale_slider = gr.Slider(
188
  examples = [["examples/" + img] for img in os.listdir("examples/")]
189
 
190
  process_image.zerogpu = True
191
- gr.set_static_paths(paths=["models/","examples/"])
192
  iface = gr.Interface(
193
  fn=process_image,
194
  inputs=[
@@ -209,8 +211,9 @@ iface = gr.Interface(
209
  allow_flagging="never",
210
  cache_examples=False,
211
  delete_cache=(86400,86400),
212
- theme="Surn/Beeuty"
 
213
  )
214
 
215
  if __name__ == "__main__":
216
- iface.launch(debug=True, show_api=False, favicon_path="./favicon.ico")
 
155
  mesh_crop = mesh.crop(bbox)
156
 
157
  # Save the mesh as a GLTF file
158
+ temp_dir = Path.cwd() / "models"
159
+ temp_dir.mkdir(exist_ok=True)
160
+ gltf_path = str(temp_dir / f"{image_path.stem}.gltf")
161
  o3d.io.write_triangle_mesh(gltf_path, mesh_crop, write_triangle_uvs=True)
162
  return gltf_path
163
 
 
190
  examples = [["examples/" + img] for img in os.listdir("examples/")]
191
 
192
  process_image.zerogpu = True
193
+ #gr.set_static_paths(paths=["models/","examples/"])
194
  iface = gr.Interface(
195
  fn=process_image,
196
  inputs=[
 
211
  allow_flagging="never",
212
  cache_examples=False,
213
  delete_cache=(86400,86400),
214
+ theme="Surn/Beeuty",
215
+ show_progress = 'full'
216
  )
217
 
218
  if __name__ == "__main__":
219
+ iface.launch(debug=True, show_api=False, favicon_path="./favicon.ico", allowed_paths=["models/","examples/"])