EdBoy2202 commited on
Commit
abf040d
·
verified ·
1 Parent(s): fcc6a63

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -8
app.py CHANGED
@@ -63,6 +63,11 @@ def load_model_and_encodings():
63
  with st.spinner('Loading model...'):
64
  model_content = hf_hub_download(repo_id="EdBoy2202/car_prediction_model", filename="car_price_modelv3.pkl")
65
  model = joblib.load(model_content)
 
 
 
 
 
66
  return model
67
  except Exception as e:
68
  st.error(f"Error loading model: {str(e)}")
@@ -78,14 +83,14 @@ def predict_price(model, brand, model_name, year):
78
  'Mileage_per_year': 12000,
79
  'Make': brand, # Use the separated make
80
  'Model': model_name, # Use the separated model
81
- 'Condition': 'Used',
82
- 'Fuel': 'Gasoline',
83
- 'Title_status': 'Clean',
84
- 'Transmission': 'Automatic',
85
- 'Drive': 'Fwd',
86
- 'Size': 'Mid-Size',
87
- 'Type': 'Sedan',
88
- 'Paint_color': 'White'
89
  }
90
 
91
  # Prepare the input for the model
 
63
  with st.spinner('Loading model...'):
64
  model_content = hf_hub_download(repo_id="EdBoy2202/car_prediction_model", filename="car_price_modelv3.pkl")
65
  model = joblib.load(model_content)
66
+
67
+ # Debug: Print the expected feature names
68
+ st.write("Model loaded successfully.")
69
+ st.write("Expected feature names:")
70
+ st.write(model.feature_names_in_) # Display the feature names
71
  return model
72
  except Exception as e:
73
  st.error(f"Error loading model: {str(e)}")
 
83
  'Mileage_per_year': 12000,
84
  'Make': brand, # Use the separated make
85
  'Model': model_name, # Use the separated model
86
+ 'Condition': 'Used', # Default condition
87
+ 'Fuel': 'Gasoline', # Default fuel type
88
+ 'Title_status': 'Clean', # Default title status
89
+ 'Transmission': 'Automatic', # Default transmission
90
+ 'Drive': 'Fwd', # Default drive
91
+ 'Size': 'Mid-Size', # Default size
92
+ 'Type': 'Sedan', # Default type
93
+ 'Paint_color': 'White' # Default color
94
  }
95
 
96
  # Prepare the input for the model