End to End project implementation from machine learning model development to deployment as a docker container to Heroku
Link: https://california-housepricing-810427063c20.herokuapp.com/
This project implements an end-to-end machine learning solution for predicting house prices in California. It consists of the following key components:
In the first step, a Linear Regression machine learning model is developed using Python. The model is trained on a dataset containing various features of houses, such as location, number of bedrooms, square footage, and more. The trained model is saved as a pickle file for later use.
A web application is created using the Flask framework. This application allows users to input information about a house and receive a predicted price based on the trained Linear Regression model. The web interface is intuitive and user-friendly, making it easy for anyone to get house price predictions.
The entire web application is containerized using Docker. This means that you can package the application and its dependencies into a Docker image, ensuring consistent and reliable deployment across different environments.
The Dockerized web application is deployed on the Heroku platform. Heroku provides a convenient and scalable platform for hosting web applications, making it accessible to users on the internet.
How to Use To use this project, follow these steps:
To set up this project locally, follow these steps:
-
Clone the repository to your local machine:
git clone https://github.com/satishkolli1992/californiahousepricing.git
-
Create a virtual environment (recommended) and install the dependencies:
cd californiahousepricing python -m venv venv source venv/bin/activate # On Windows, use: venv\Scripts\activate pip install -r requirements.txt
-
Run the Flask application locally:
python app/app.py
You can access the web application by opening a browser and navigating to http://localhost:5000.
The Linear Regression model was developed using the Jupyter notebook californiahousepricing /Linear regression - ML Implementation - California Housing.ipynb.ipynb
. The trained model is saved as californiahousepricing/regmodel.pkl
. This model is used for making house price predictions in the web application.
The web application is built using the Flask framework and allows users to input various features of a house and get a predicted price. The main files for the web application are located in the app/
directory. The application include a HTML templates (home.html
) and Python code in app.py
.
To run the application in a Docker container, use the provided Dockerfile
. You can build the Docker image and run the container locally using Docker Desktop or a similar tool.
docker build -t californiahousepricing .
docker run -p 5000:5000 californiahousepricing
The web application is deployed on Heroku as a Docker container. To deploy your own version of this application on Heroku, follow these general steps:
-
Create a Heroku account and install the Heroku CLI if you haven't already.
-
Log in to Heroku using the CLI:
heroku login
-
Navigate to the project directory and create a Heroku app:
heroku create your-app-name
-
Push the Docker container to Heroku:
heroku container:push web -a your-app-name
-
Release the container:
heroku container:release web -a your-app-name
-
Open your Heroku app in the browser:
heroku open -a your-app-name
Now, your California House Price Prediction web application is live on Heroku!
Feel free to customize and improve this project as needed. Happy coding!