LTT commited on
Commit
1b0c6c9
1 Parent(s): a3a553c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -10
app.py CHANGED
@@ -71,16 +71,6 @@ def find_cuda():
71
 
72
  return None
73
 
74
-
75
-
76
- install_cuda_toolkit()
77
-
78
- cuda_path = find_cuda()
79
-
80
- if cuda_path:
81
- print(f"CUDA installation found at: {cuda_path}")
82
- else:
83
- print("CUDA installation not found")
84
  # import os
85
 
86
  # # 确保 CUDA_HOME 设置正确
@@ -352,6 +342,19 @@ def make_mesh(mesh_fpath, planes):
352
 
353
  @spaces.GPU
354
  def make3d(images):
 
 
 
 
 
 
 
 
 
 
 
 
 
355
  print(f"CUDA_HOME:{os.environ.get('CUDA_HOME')}")
356
  print(f"CUDA_HOME exist:{os.path.exists(os.environ.get('CUDA_HOME'))}")
357
  global model
 
71
 
72
  return None
73
 
 
 
 
 
 
 
 
 
 
 
74
  # import os
75
 
76
  # # 确保 CUDA_HOME 设置正确
 
342
 
343
  @spaces.GPU
344
  def make3d(images):
345
+ install_cuda_toolkit()
346
+
347
+ cuda_path = find_cuda()
348
+
349
+ if cuda_path:
350
+ print(f"CUDA installation found at: {cuda_path}")
351
+ else:
352
+ print("CUDA installation not found")
353
+ os.environ['CUDA_HOME'] = '/usr/local/cuda'
354
+ os.environ['PATH'] += ':/usr/local/cuda/bin'
355
+ os.environ['LD_LIBRARY_PATH'] += ':/usr/local/cuda/lib64'
356
+
357
+ subprocess.run(['nvidia-smi']) # 测试 CUDA 是否可用
358
  print(f"CUDA_HOME:{os.environ.get('CUDA_HOME')}")
359
  print(f"CUDA_HOME exist:{os.path.exists(os.environ.get('CUDA_HOME'))}")
360
  global model