ranimeree commited on
Commit
a9e59c6
·
verified ·
1 Parent(s): cf95935

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -20
app.py CHANGED
@@ -9,27 +9,12 @@ import os
9
  print(f"Prediction environment scikit-learn version: {sklearn.__version__}")
10
 
11
  def decode_file(file_path):
12
- try:
13
- with open(file_path, 'rb') as file:
14
- obj = pickle.load(file)
15
- return obj
16
- except FileNotFoundError:
17
- print(f"Error: File not found at {file_path}")
18
- return None
19
- except Exception as e:
20
- print(f"Error loading pickle file: {e}")
21
- return None
22
 
23
- # Load the model once when starting the app
24
- try:
25
- model = decode_file('model.pkl') # Updated here
26
- if model is not None:
27
- print("Model loaded successfully")
28
- else:
29
- print("Model loading failed, None value")
30
- except Exception as e:
31
- print(f"Error loading model: {e}")
32
- model = None
33
 
34
  def preprocess_input(data_dict):
35
  """Preprocess input data to match the training format"""
 
9
  print(f"Prediction environment scikit-learn version: {sklearn.__version__}")
10
 
11
  def decode_file(file_path):
12
+ with open(file_path, 'rb') as file:
13
+ obj = pickle.load(file)
14
+ return obj
 
 
 
 
 
 
 
15
 
16
+ # Load the model without try/except
17
+ model = decode_file('./model.pkl')
 
 
 
 
 
 
 
 
18
 
19
  def preprocess_input(data_dict):
20
  """Preprocess input data to match the training format"""