Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -186,17 +186,21 @@ def _run_advisor(
|
|
| 186 |
|
| 187 |
# For manual input without image, use heuristic (ML model needs too many features we don't have)
|
| 188 |
# For image-based input, use ML model if available
|
| 189 |
-
price_input = {
|
| 190 |
-
"make_model": make_model_input,
|
| 191 |
-
"body_type": predicted_class if vision_results.get("method") != "manual_input" else None,
|
| 192 |
-
"km": to_float(mileage_km, 80000),
|
| 193 |
-
"age": age,
|
| 194 |
-
}
|
| 195 |
-
|
| 196 |
-
# If manual input (no vision results), use heuristic directly to get brand-aware pricing
|
| 197 |
if vision_results.get("method") == "manual_input":
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 198 |
price_prediction = price_predictor._heuristic_estimate(price_input)
|
| 199 |
else:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 200 |
price_prediction = predict_price(price_input)
|
| 201 |
|
| 202 |
user_inputs = {
|
|
|
|
| 186 |
|
| 187 |
# For manual input without image, use heuristic (ML model needs too many features we don't have)
|
| 188 |
# For image-based input, use ML model if available
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 189 |
if vision_results.get("method") == "manual_input":
|
| 190 |
+
# Manual input: use heuristic with make_model for brand detection
|
| 191 |
+
price_input = {
|
| 192 |
+
"make_model": make_model_input,
|
| 193 |
+
"hp_kW": None,
|
| 194 |
+
"Fuel": None,
|
| 195 |
+
}
|
| 196 |
price_prediction = price_predictor._heuristic_estimate(price_input)
|
| 197 |
else:
|
| 198 |
+
# Image-based: try ML model with available features
|
| 199 |
+
price_input = {
|
| 200 |
+
"make_model": make_model_input,
|
| 201 |
+
"hp_kW": None,
|
| 202 |
+
"Fuel": None,
|
| 203 |
+
}
|
| 204 |
price_prediction = predict_price(price_input)
|
| 205 |
|
| 206 |
user_inputs = {
|