gmanolache commited on
Commit
af8610c
·
verified ·
1 Parent(s): 04501ea

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -4
app.py CHANGED
@@ -86,16 +86,20 @@ def load_model(file_path: str):
86
  try:
87
  model = joblib.load(file_path)
88
  return SKLearnWrapper(model)
89
- except:
90
  try:
91
  with open(file_path, "rb") as f:
92
  model = pickle.load(f)
93
  return SKLearnWrapper(model)
94
- except:
95
  try:
96
  return TorchPredictWrapper(file_path)
97
- except Exception as e:
98
- raise RuntimeError(f"Unrecognized model format or failed to load: {e}")
 
 
 
 
99
 
100
  # ===============================
101
  # Step 5: Evaluation Logic
 
86
  try:
87
  model = joblib.load(file_path)
88
  return SKLearnWrapper(model)
89
+ except Exception as e1:
90
  try:
91
  with open(file_path, "rb") as f:
92
  model = pickle.load(f)
93
  return SKLearnWrapper(model)
94
+ except Exception as e2:
95
  try:
96
  return TorchPredictWrapper(file_path)
97
+ except Exception as e3:
98
+ raise RuntimeError(f"Unrecognized model format or failed to load:\n"
99
+ f"joblib error: {e1}\n"
100
+ f"pickle error: {e2}\n"
101
+ f"torch error: {e3}")
102
+
103
 
104
  # ===============================
105
  # Step 5: Evaluation Logic