perler commited on
Commit
bc70951
·
1 Parent(s): 5f42443

try rec without subprocess

Browse files
Files changed (1) hide show
  1. app.py +17 -10
app.py CHANGED
@@ -23,20 +23,27 @@ def run_on_gpu(input_point_cloud: gr.utils.NamedString,
23
  type(gen_subsample_manifold_iter), type(gen_refine_iter))
24
 
25
  import os
26
- os.chdir(os.path.dirname('./ppsurf'))
 
 
 
27
 
28
  in_file = 'data/{}'.format(input_point_cloud.name)
29
  out_file = 'results/rec/{}'.format(input_point_cloud.name)
30
 
31
- call_base = ['python', 'pps.py', 'rec']
32
- call_args = [in_file,
33
- out_file,
34
- '--gen_resolution_global', str(gen_resolution_global),
35
- '--padding_factor', str(padding_factor),
36
- '--gen_subsample_manifold_iter', str(gen_subsample_manifold_iter),
37
- '--gen_refine_iter', str(gen_refine_iter),
38
- ]
39
- subprocess.run(call_base + call_args)
 
 
 
 
40
  print('Finished inference at {}'.format(datetime.datetime.now()))
41
 
42
  result_3d_model = out_file
 
23
  type(gen_subsample_manifold_iter), type(gen_refine_iter))
24
 
25
  import os
26
+ import sys
27
+ # os.chdir(os.path.dirname('./ppsurf'))
28
+ sys.path.append(os.path.abspath('ppsurf'))
29
+ from ppsurf.pps import cli_main
30
 
31
  in_file = 'data/{}'.format(input_point_cloud.name)
32
  out_file = 'results/rec/{}'.format(input_point_cloud.name)
33
 
34
+ args = [
35
+ 'pps.py', 'rec',
36
+ in_file,
37
+ out_file,
38
+ '--gen_resolution_global', str(gen_resolution_global),
39
+ '--padding_factor', str(padding_factor),
40
+ '--gen_subsample_manifold_iter', str(gen_subsample_manifold_iter),
41
+ '--gen_refine_iter', str(gen_refine_iter),
42
+ ]
43
+
44
+ sys.argv = args
45
+ cli_main()
46
+ # subprocess.run(call_base + call_args)
47
  print('Finished inference at {}'.format(datetime.datetime.now()))
48
 
49
  result_3d_model = out_file