test
Browse files
app.py
CHANGED
@@ -88,19 +88,42 @@ image_input = gr.Image(label="Choose an image to featurize",
|
|
88 |
model_option = gr.Radio(options, value="dino16",
|
89 |
label='Choose a backbone to upsample')
|
90 |
|
|
|
91 |
@spaces.GPU
|
92 |
def upsample_features(image, model_option):
|
93 |
|
94 |
-
#
|
95 |
-
|
96 |
-
|
97 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
98 |
raise EnvironmentError(
|
99 |
-
'
|
100 |
|
101 |
-
|
102 |
-
cuda_dirs.sort()
|
103 |
-
cuda_home = cuda_dirs[-1]
|
104 |
|
105 |
# Set the CUDA_HOME environment variable
|
106 |
os.environ['CUDA_HOME'] = cuda_home
|
|
|
88 |
model_option = gr.Radio(options, value="dino16",
|
89 |
label='Choose a backbone to upsample')
|
90 |
|
91 |
+
|
92 |
@spaces.GPU
|
93 |
def upsample_features(image, model_option):
|
94 |
|
95 |
+
# Check common CUDA installation paths and set the correct one
|
96 |
+
cuda_paths = [
|
97 |
+
'/usr/local/cuda',
|
98 |
+
'/usr/local/cuda-10.0',
|
99 |
+
'/usr/local/cuda-10.1',
|
100 |
+
'/usr/local/cuda-10.2',
|
101 |
+
'/usr/local/cuda-11.0',
|
102 |
+
'/usr/local/cuda-11.1',
|
103 |
+
'/usr/local/cuda-11.2',
|
104 |
+
'/usr/local/cuda-11.3',
|
105 |
+
'/usr/local/cuda-11.4',
|
106 |
+
'/usr/local/cuda-11.5',
|
107 |
+
'/usr/local/cuda-11.6',
|
108 |
+
'/usr/local/cuda-11.7',
|
109 |
+
'/usr/local/cuda-11.8',
|
110 |
+
'/usr/local/cuda-12.0',
|
111 |
+
'/usr/local/cuda-12.1',
|
112 |
+
'/usr/lib/cuda',
|
113 |
+
'/opt/cuda'
|
114 |
+
]
|
115 |
+
|
116 |
+
cuda_home = None
|
117 |
+
for path in cuda_paths:
|
118 |
+
if os.path.exists(path):
|
119 |
+
cuda_home = path
|
120 |
+
break
|
121 |
+
|
122 |
+
if cuda_home is None:
|
123 |
raise EnvironmentError(
|
124 |
+
'CUDA installation not found. Please install CUDA or set CUDA_HOME manually.')
|
125 |
|
126 |
+
print(cuda_home)
|
|
|
|
|
127 |
|
128 |
# Set the CUDA_HOME environment variable
|
129 |
os.environ['CUDA_HOME'] = cuda_home
|