Spaces:
Runtime error
Runtime error
Update app.py
Browse files8 unmodified lines910111213141516171819208 unmodified linesprint(f"Prediction environment scikit-learn version: {sklearn.__version__}")def decode_file(file_path):with open(file_path, 'rb') as file:obj = pickle.load(file)return obj# Load the model without try/exceptmodel = decode_file('model.pkl')def preprocess_input(data_dict):"""Preprocess input data to match the training format"""8 unmodified lines910111213141516171819202122232425262728293031323334358 unmodified linesprint(f"Prediction environment scikit-learn version: {sklearn.__version__}")def decode_file(file_path):try:with open(file_path, 'rb') as file:obj = pickle.load(file)return objexcept FileNotFoundError:print(f"Error: File not found at {file_path}")return Noneexcept Exception as e:print(f"Error loading pickle file: {e}")return None# Load the model once when starting the apptry:model = decode_file('./model.pkl')if model is not None:print("Model loaded successfully")else:print("Model loading failed, None value")except Exception as e:print(f"Error loading model: {e}")model = Nonedef preprocess_input(data_dict):"""Preprocess input data to match the training format"""
app.py+20-5