immo-predictor / README.md
lucifer92i's picture
Deploy Immo Predictor API + Gradio UI
106e48b
metadata
title: Immo Predictor
emoji: ๐Ÿ 
colorFrom: blue
colorTo: indigo
sdk: docker
pinned: false
license: mit

Immo Predictor API

API de Machine Learning pour l'immobilier, construite avec FastAPI + Gradio.

Fonctionnalite Description
Regression Prediction du prix de vente (SalePrice)
Classification Classification du type de batiment (BldgType)

Auteur : mamadousy92i


Lancer en local

# Creer un environnement virtuel
python3 -m venv venv
source venv/bin/activate

# Installer les dependances
pip install -r requirements.txt

# Demarrer le serveur
python -m uvicorn app.main:app --reload --port 8000

Endpoints

GET / โ€” Message de bienvenue

curl http://localhost:8000/

GET /health โ€” Statut de l'API

curl http://localhost:8000/health

GET /models/info โ€” Informations sur les modeles

curl http://localhost:8000/models/info

POST /regression/predict โ€” Predire le prix

Parametre query : model = random_forest (defaut) | decision_tree

curl -X POST "http://localhost:8000/regression/predict?model=random_forest" \
  -H "Content-Type: application/json" \
  -d '{
    "GrLivArea": 1500,
    "TotalBsmtSF": 800,
    "LotArea": 9000,
    "BedroomAbvGr": 3,
    "FullBath": 2,
    "TotRmsAbvGrd": 7,
    "OverallQual": 7,
    "OverallCond": 5,
    "YearBuilt": 2000,
    "YearRemodAdd": 2005,
    "Neighborhood": "NAmes",
    "GarageCars": 2,
    "GarageArea": 500,
    "PoolArea": 0,
    "Fireplaces": 1
  }'

Reponse :

{
  "model_used": "random_forest",
  "predicted_price": 185000.0,
  "currency": "USD"
}

POST /classification/predict โ€” Classifier le type de bien

Parametre query : model = random_forest (defaut) | svm

curl -X POST "http://localhost:8000/classification/predict?model=svm" \
  -H "Content-Type: application/json" \
  -d '{
    "GrLivArea": 1500,
    "TotRmsAbvGrd": 7,
    "OverallQual": 7,
    "YearBuilt": 2000,
    "GarageCars": 2,
    "Neighborhood": "NAmes",
    "HouseStyle": "1Story"
  }'

Reponse :

{
  "model_used": "svm",
  "predicted_type": "1Fam",
  "predicted_type_encoded": 0
}

Docker (HuggingFace Spaces)

docker build -t immo-predictor .
docker run -p 7860:7860 immo-predictor

Demo HuggingFace

Lien a ajouter apres deploiement.


GitHub

https://github.com/mamadousy92i