Chia Woon Yap
commited on
Update app.py
Browse files
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 |
-
|
|
|
|
|
|
|
| 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
|