Update app.py
Browse files
app.py
CHANGED
@@ -9,8 +9,32 @@ from pulid.utils import resize_numpy_image_long, seed_everything
|
|
9 |
|
10 |
torch.set_grad_enabled(False)
|
11 |
|
12 |
-
import
|
13 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
|
15 |
pipeline = PuLIDPipeline()
|
16 |
|
|
|
9 |
|
10 |
torch.set_grad_enabled(False)
|
11 |
|
12 |
+
import shutil
|
13 |
+
|
14 |
+
def find_cuda():
|
15 |
+
# Check if CUDA_HOME or CUDA_PATH environment variables are set
|
16 |
+
cuda_home = os.environ.get('CUDA_HOME') or os.environ.get('CUDA_PATH')
|
17 |
+
|
18 |
+
if cuda_home and os.path.exists(cuda_home):
|
19 |
+
return cuda_home
|
20 |
+
|
21 |
+
# Search for the nvcc executable in the system's PATH
|
22 |
+
nvcc_path = shutil.which('nvcc')
|
23 |
+
|
24 |
+
if nvcc_path:
|
25 |
+
# Remove the 'bin/nvcc' part to get the CUDA installation path
|
26 |
+
cuda_path = os.path.dirname(os.path.dirname(nvcc_path))
|
27 |
+
return cuda_path
|
28 |
+
|
29 |
+
return None
|
30 |
+
|
31 |
+
cuda_path = find_cuda()
|
32 |
+
|
33 |
+
if cuda_path:
|
34 |
+
print(f"CUDA installation found at: {cuda_path}")
|
35 |
+
else:
|
36 |
+
print("CUDA installation not found")
|
37 |
+
|
38 |
|
39 |
pipeline = PuLIDPipeline()
|
40 |
|