RezinWiz commited on
Commit
7b883e9
Β·
verified Β·
1 Parent(s): 8489fe2

Update api.py

Browse files
Files changed (1) hide show
  1. api.py +11 -2
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 from the original path
148
- keras_filename = os.path.basename(keras_model_path)
 
 
 
 
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}")