wyysf commited on
Commit
9dd707f
β€’
1 Parent(s): 10c831f

Update gradio_app.py

Browse files
Files changed (1) hide show
  1. gradio_app.py +26 -0
gradio_app.py CHANGED
@@ -59,6 +59,32 @@ If you have any questions, feel free to open a discussion or contact us at <b>we
59
  from apps.third_party.CRM.pipelines import TwoStagePipeline
60
  from apps.third_party.LGM.pipeline_mvdream import MVDreamPipeline
61
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
62
 
63
  model = None
64
  cached_dir = None
 
59
  from apps.third_party.CRM.pipelines import TwoStagePipeline
60
  from apps.third_party.LGM.pipeline_mvdream import MVDreamPipeline
61
 
62
+ import re
63
+ import os
64
+ import stat
65
+
66
+ RD, WD, XD = 4, 2, 1
67
+ BNS = [RD, WD, XD]
68
+ MDS = [
69
+ [stat.S_IRUSR, stat.S_IRGRP, stat.S_IROTH],
70
+ [stat.S_IWUSR, stat.S_IWGRP, stat.S_IWOTH],
71
+ [stat.S_IXUSR, stat.S_IXGRP, stat.S_IXOTH]
72
+ ]
73
+
74
+ def chmod(path, mode):
75
+ if isinstance(mode, int):
76
+ mode = str(mode)
77
+ if not re.match("^[0-7]{1,3}$", mode):
78
+ raise Exception("mode does not conform to ^[0-7]{1,3}$ pattern")
79
+ mode = "{0:0>3}".format(mode)
80
+ mode_num = 0
81
+ for midx, m in enumerate(mode):
82
+ for bnidx, bn in enumerate(BNS):
83
+ if (int(m) & bn) > 0:
84
+ mode_num += MDS[bnidx][midx]
85
+ os.chmod(path, mode_num)
86
+
87
+ chmod(f"{parent_dir}/apps/third_party/InstantMeshes", "777")
88
 
89
  model = None
90
  cached_dir = None