File size: 2,550 Bytes
bad35ad
 
 
 
 
 
 
 
 
9ae73a2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
---
title: Housing API
emoji: 😻
colorFrom: yellow
colorTo: purple
sdk: docker
pinned: false
---

# API-Housing-Price-Prediction
### Documentation pour le Repository de l'API

#### 📖 Description du Projet
Ce repository contient le code source de l'API de prédiction des prix des maisons utilisant FastAPI. Cette API prend en entrée diverses caractéristiques d'une maison et renvoie le prix prédit.

#### 🚀 Installation
Suivez les étapes ci-dessous pour installer et exécuter l'API en local.

1. **Cloner le Repository :**
   ```bash
   git clone https://github.com/abrahamkoloboe27/API-Housing-Price-Prediction.git
   cd API-Housing-Price-Prediction
   ```

2. **Créer et Activer un Environnement Virtuel :**
   ```bash
   python -m venv venv
   source venv/bin/activate  # Sur Windows, utilisez `venv\Scripts\activate`
   ```

3. **Installer les Dépendances :**
   ```bash
   pip install -r requirements.txt
   ```

4. **Lancer l'API :**
   ```bash
   uvicorn api:app --reload
   ```

#### 📝 Utilisation
Une fois l'API en cours d'exécution, vous pouvez envoyer des requêtes POST à l'endpoint `/predict` avec les caractéristiques de la maison pour obtenir une prédiction de prix.

#### 📄 Exemple de Requête avec `curl`
```bash
curl -X POST "http://127.0.0.1:8000/predict" -H "Content-Type: application/json" -d '{
    "area": 2640,
    "bedrooms": 2,
    "bathrooms": 1,
    "stories": 1,
    "mainroad": "no",
    "guestroom": "no",
    "basement": "no",
    "hotwaterheating": "no",
    "airconditioning": "no",
    "parking": 1,
    "prefarea": "no",
    "furnishingstatus": "furnished"
}'
```

#### 📄 Exemple de Requête avec JavaScript
```javascript
fetch("http://127.0.0.1:8000/predict", {
    method: "POST",
    headers: {
        "Content-Type": "application/json"
    },
    body: JSON.stringify({
        area: 2640,
        bedrooms: 2,
        bathrooms: 1,
        stories: 1,
        mainroad: "no",
        guestroom: "no",
        basement: "no",
        hotwaterheating: "no",
        airconditioning: "no",
        parking: 1,
        prefarea: "no",
        furnishingstatus: "furnished"
    })
})
.then(response => response.json())
.then(data => console.log(data));
```

#### 🔗 Liens Utiles
- [Documentation de FastAPI](https://fastapi.tiangolo.com/)
- [Repository GitHub](https://github.com/abrahamkoloboe27/API-Housing-Price-Prediction)

#### 📧 Contact
Pour toute question ou suggestion, veuillez contacter Abraham KOLOBOE à l'adresse email [abklb27@gmail.com](mailto:abklb27@gmail.com).