perler commited on
Commit
c30a026
1 Parent(s): 2bf1ee8

try temp folder

Browse files
Files changed (1) hide show
  1. app.py +8 -4
app.py CHANGED
@@ -24,18 +24,22 @@ def run_on_gpu(input_point_cloud: gr.utils.NamedString,
24
 
25
  sys.path.append(os.path.abspath('ppsurf'))
26
  import subprocess
 
27
 
28
  in_file = '{}'.format(input_point_cloud.name)
29
- out_dir = os.path.dirname(in_file)
30
- out_subdir = os.path.join(out_dir, os.path.basename(in_file))
 
31
  out_file_basename = os.path.basename(in_file) + '.ply'
32
  out_file = os.path.join(out_dir, os.path.basename(in_file), out_file_basename)
 
33
  print('in_file:', in_file)
34
  print('out_dir:', out_dir)
35
- print('out_subdir:', out_subdir)
36
  print('out_file:', out_file)
 
37
  os.makedirs(out_dir, exist_ok=True)
38
- os.makedirs(out_subdir, exist_ok=True)
 
39
 
40
  model_path = 'models/ppsurf_50nn/version_0/checkpoints/last.ckpt'
41
 
 
24
 
25
  sys.path.append(os.path.abspath('ppsurf'))
26
  import subprocess
27
+ import uuid
28
 
29
  in_file = '{}'.format(input_point_cloud.name)
30
+
31
+ rand_hash = uuid.uuid4().hex
32
+ out_dir = '/tmp/outputs/{}'.format(rand_hash)
33
  out_file_basename = os.path.basename(in_file) + '.ply'
34
  out_file = os.path.join(out_dir, os.path.basename(in_file), out_file_basename)
35
+ out_file_gradio = os.path.splitext(in_file)[0] + '_ppsurf.ply'
36
  print('in_file:', in_file)
37
  print('out_dir:', out_dir)
 
38
  print('out_file:', out_file)
39
+ print('out_file_gradio:', out_file_gradio)
40
  os.makedirs(out_dir, exist_ok=True)
41
+ import shutil
42
+ shutil.copyfile(src=out_file, dst=out_file_gradio)
43
 
44
  model_path = 'models/ppsurf_50nn/version_0/checkpoints/last.ckpt'
45