A Flask API able to predict the price of an apartment from provided attributes. The model was trained on apartment data from Aruodas.lt with the help of the scrape_aruodas package.
Aruodas.lt Apartment Price Predictor API currently supports:
- POST requests
- Single or multiple apartment predictions with a single request
- Storing the data in a remote Heroku database
- Invalid input handling
- Visual user interface
Aruodas.lt Apartment Price Predictor API uses a number of open source projects to work properly:
- Python - The programming language for of this project
- Scrape_Aruodas - Scrape_Aruodas is a web scraper designed to scrape Aruodas.lt apartment listings
- Flask - Flask is a lightweight WSGI web application framework
- Scikit-learn - Scikit-learn is a free software machine learning library for the Python programming language
- Pickle - Python object serialization
- JSON - JSON encoder and decoder
- NumPy - The fundamental package for scientific computing with Python
- Aruodas.lt Apartment Price Predictor API requires at least Python version 3.7
-
Clone the repository to a local directory
-
Create a virtual environment
$ python -m venv venv
-
Activate the virtual environment
$ venv\Scripts\activate.bat
-
Install required libraries
$ pip install git+https://github.com/valdas-v1/scrape_aruodas $ pip install -r requirements.txt
-
Update database connection credentials in database.py
self.engine = create_engine(YOUR_DATABASE_URI)
Run the API as any other Python file
$ python app.py
To use the API, make a POST request to the route of /predict
with the sample JSON structure of
{
"inputs": [
{
"Area": 100,
"Build year": 1985,
"Building type": "Brick",
"Equipment": "Fully equipped",
"Floor": 1,
"Heating system": "Central thermostat",
"No. of floors": 9,
"Number of rooms": 3,
"Renovation year": 2010,
"city": "Vilnius",
"region": "Šnipiškės",
"street": "Rinktinės g."
}
]
}
Body of expected response
{"predicted_prices": [225679.79271469155]}