/barcelona-hpp

Barcelona House Price Predictor - Simple app to learn a FastAPI backend + React frontend

Primary LanguagePythonGNU General Public License v3.0GPL-3.0

Barcelona House Price Prediction

I wrote this application to learn how to develop a single-page app. The app gives suggestion on the price one should pay for an apartment in select neighbourhoods of Barcelona, based on a dataset of offer prices.

Backend

The backend is written in Python and uses FastAPI to serve requests. Resource '/' expects five parameters:

  • neighbourhood (string): either 'sarria' or 'poblenou';
  • sqm (int): square metres;
  • rooms (int): number of bedrooms;
  • state (str): either 'need_renovation', 'second_hand' or 'new';
  • elevator (boolean): whether the builing has an elevator.

If returns a JSON object with information on how much you should pay, a comparison with similar apartments, and an array of similar listings.

You can launch the server from the backend folder with command uvicorn main:app --reload.

Frontend

The frontend is a React single-page app with a form to input the data. It performs a fetch request to the backend and presents the resutls to the user.

You can launch the server from the frontend folder with command npm start.

License

This software is released under the GPLv3 license (see file LICENSE).