17 lines
558 B
Python
17 lines
558 B
Python
import os
|
|
import joblib
|
|
import numpy as np
|
|
|
|
from backend.app.dtos.house.house_features import HouseFeatures
|
|
|
|
class HousePricePredictor:
|
|
"""
|
|
Mock ML model that predicts house prices.
|
|
In a real scenario, this would load a trained model.
|
|
"""
|
|
def __init__(self):
|
|
self.model = joblib.load("backend/app/ai_models/price_predictor.pkl")
|
|
|
|
def predict(self, features: HouseFeatures) -> float:
|
|
X = np.array([[features.square_feet, features.bedrooms, features.bathrooms]])
|
|
return self.model.predict(X)[0] * 100000 |