Chia Woon Yap commited on
Commit
3f2ed30
·
verified ·
1 Parent(s): b616228

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -2
app.py CHANGED
@@ -305,10 +305,13 @@ def predict_hdb_price(town, flat_type, flat_model, floor_area_sqm, storey_level,
305
 
306
  # Get prediction with error handling
307
  try:
308
- predicted_price = max(0, float(models['xgboost'].predict(processed_input)[0]))
 
309
  except Exception as e:
310
  print(f"❌ XGBoost prediction error: {e}")
311
- predicted_price = 420000 # Fallback value
 
 
312
 
313
  # Create insights
314
  remaining_lease = 99 - flat_age
 
305
 
306
  # Get prediction with error handling
307
  try:
308
+ #predicted_price = max(0, float(models['xgboost'].predict(processed_input)[0]))
309
+ predicted_price = max(100000, float(models['xgboost'].predict(processed_input)
310
  except Exception as e:
311
  print(f"❌ XGBoost prediction error: {e}")
312
+ # Smarter fallback based on area
313
+ predicted_price = max(100000, floor_area_sqm * 5000) # Better fallback calculatio
314
+ #predicted_price = 420000 # Fallback value
315
 
316
  # Create insights
317
  remaining_lease = 99 - flat_age