Spaces:
Sleeping
Sleeping
from catboost import CatBoostClassifier | |
import os | |
def test_model_loading(): | |
possible_paths = [ | |
os.path.join(os.getcwd(), "catboost_model.bin"), | |
"/app/catboost_model.bin", | |
"catboost_model.bin" | |
] | |
formats_to_try = [None, 'binnar', 'json', 'coreml'] | |
for path in possible_paths: | |
if os.path.exists(path): | |
print(f"Found model at: {path}") | |
for format in formats_to_try: | |
model = CatBoostClassifier() | |
try: | |
if format is None: | |
model.load_model(path) | |
else: | |
model.load_model(path, format=format) | |
print(f"Successfully loaded model from {path} with format {format}") | |
return True | |
except Exception as e: | |
print(f"Failed to load from {path} with format {format}: {str(e)}") | |
print("Model not found in any location") | |
return False | |
if __name__ == "__main__": | |
test_model_loading() | |