Spaces:
Running
Running
Update api.py
Browse files
api.py
CHANGED
|
@@ -144,8 +144,12 @@ class DermFoundationNeuralNetwork:
|
|
| 144 |
# Get the directory where the pickle file is located
|
| 145 |
pickle_dir = os.path.dirname(os.path.abspath(filepath))
|
| 146 |
|
| 147 |
-
# Extract just the filename
|
| 148 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 149 |
|
| 150 |
# Try looking for it in the same directory as the pickle
|
| 151 |
alternative_path = os.path.join(pickle_dir, keras_filename)
|
|
@@ -156,6 +160,11 @@ class DermFoundationNeuralNetwork:
|
|
| 156 |
print(f"β Found keras model at: {keras_model_path}")
|
| 157 |
else:
|
| 158 |
print(f"β Keras model not found at alternative path either")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 159 |
return False
|
| 160 |
else:
|
| 161 |
print(f"β Found keras model at original path: {keras_model_path}")
|
|
|
|
| 144 |
# Get the directory where the pickle file is located
|
| 145 |
pickle_dir = os.path.dirname(os.path.abspath(filepath))
|
| 146 |
|
| 147 |
+
# Extract just the filename, handling both Windows and Unix paths
|
| 148 |
+
# Replace backslashes with forward slashes first
|
| 149 |
+
normalized_path = keras_model_path.replace('\\', '/')
|
| 150 |
+
keras_filename = normalized_path.split('/')[-1]
|
| 151 |
+
|
| 152 |
+
print(f"Extracted filename: {keras_filename}")
|
| 153 |
|
| 154 |
# Try looking for it in the same directory as the pickle
|
| 155 |
alternative_path = os.path.join(pickle_dir, keras_filename)
|
|
|
|
| 160 |
print(f"β Found keras model at: {keras_model_path}")
|
| 161 |
else:
|
| 162 |
print(f"β Keras model not found at alternative path either")
|
| 163 |
+
print(f"Files in {pickle_dir}:")
|
| 164 |
+
try:
|
| 165 |
+
print(os.listdir(pickle_dir))
|
| 166 |
+
except:
|
| 167 |
+
pass
|
| 168 |
return False
|
| 169 |
else:
|
| 170 |
print(f"β Found keras model at original path: {keras_model_path}")
|