Huiwenshi commited on
Commit
c8486ac
1 Parent(s): 4496654

Upload app_hg.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. app_hg.py +19 -9
app_hg.py CHANGED
@@ -35,6 +35,24 @@ from einops import rearrange
35
  import pandas as pd
36
  from huggingface_hub import snapshot_download
37
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
38
  from infer import seed_everything, save_gif
39
  from infer import Text2Image, Removebg, Image2Views, Views2Mesh, GifRenderer
40
  from third_party.check import check_bake_available
@@ -94,15 +112,7 @@ except Exception as err:
94
  print(err)
95
  print("import baking related files fail, running without baking")
96
  BAKE_AVAILEBLE = False
97
-
98
- from glob import glob
99
- print(glob("/usr/local/cuda/*"))
100
- print(torch.cuda.is_available())
101
- print(os.environ.get('CUDA_HOME', None))
102
- os.environ['CUDA_HOME'] = '/usr/local/cuda'
103
- # Optionally, update PATH and LD_LIBRARY_PATH if needed
104
- os.environ['PATH'] = os.environ['CUDA_HOME'] + '/bin:' + os.environ['PATH']
105
- os.environ['LD_LIBRARY_PATH'] = os.environ['CUDA_HOME'] + '/lib64:' + os.environ.get('LD_LIBRARY_PATH', '')
106
 
107
  ################################################################
108
  # initial setting
 
35
  import pandas as pd
36
  from huggingface_hub import snapshot_download
37
 
38
+ import sys
39
+ import subprocess
40
+ from glob import glob
41
+
42
+ @spaces.GPU
43
+ def check_env():
44
+ print(glob("/usr/local/cuda/*"))
45
+ print(torch.cuda.is_available())
46
+ print(os.environ.get('CUDA_HOME', None))
47
+ os.environ['CUDA_HOME'] = '/usr/local/cuda'
48
+ # Optionally, update PATH and LD_LIBRARY_PATH if needed
49
+ os.environ['PATH'] = os.environ['CUDA_HOME'] + '/bin:' + os.environ['PATH']
50
+ os.environ['LD_LIBRARY_PATH'] = os.environ['CUDA_HOME'] + '/lib64:' + os.environ.get('LD_LIBRARY_PATH', '')
51
+ subprocess.check_call([sys.executable, "-m", "pip", "install", "git+https://github.com/NVlabs/nvdiffrast.git"])
52
+ import nvdiffrast
53
+
54
+ check_env()
55
+
56
  from infer import seed_everything, save_gif
57
  from infer import Text2Image, Removebg, Image2Views, Views2Mesh, GifRenderer
58
  from third_party.check import check_bake_available
 
112
  print(err)
113
  print("import baking related files fail, running without baking")
114
  BAKE_AVAILEBLE = False
115
+
 
 
 
 
 
 
 
 
116
 
117
  ################################################################
118
  # initial setting