Welcome to the Predict Future Sales web application! This interactive and visually appealing Flask-based app uses machine learning to deliver precise sales predictions for shops and items based on historical data. Designed with usability and performance in mind, this tool helps businesses make informed decisions with ease.
- Dropdown menus for easy selection of shop and item IDs.
- Real-time display of predictions after submission.
- Fully responsive and mobile-friendly design.
- Predict future sales by analyzing historical trends.
- Powered by a robust XGBoost model trained on a rich dataset.
- Dynamic endpoints for fetching available shop and item IDs.
- RESTful API integration for seamless data exchange.
Ensure you have the following before getting started:
- Python Environment: Python 3.7 or higher.
- Libraries: Flask, pandas, numpy, scikit-learn, xgboost, joblib.
- Data and Model:
- Datasets:
sales_train.csv
,items.csv
,item_categories.csv
,shops.csv
. - Pre-trained model:
sales_model.pkl
.
- Datasets:
app.py
: The main Flask application file containing all logic and routes.templates/index.html
: Interactive HTML template for the user interface.- Static Files: Add custom styles and scripts for enhanced visual appeal.
- Datasets and Model Files: Necessary for accurate predictions.
-
Clone the Repository
git clone https://github.com/mischieff01/Predict-Future-Sales.git cd Predict-Future-Sales
-
Install Required Libraries Use pip to install dependencies:
pip install flask pandas numpy scikit-learn xgboost joblib
-
Prepare Data and Model
- Place the dataset files (
sales_train.csv
,items.csv
,item_categories.csv
,shops.csv
) in the specified directory. - Ensure the pre-trained model file (
sales_model.pkl
) is accessible as defined inapp.py
.
- Place the dataset files (
-
Run the Application Start the Flask server:
python app.py
Access the app at
http://127.0.0.1:5000/
. -
Enhance with Custom Features
- Personalize the frontend (
index.html
) with branding and animations. - Add advanced error handling and logging for better reliability.
- Personalize the frontend (
Open your browser and navigate to http://127.0.0.1:5000/
.
- Shop ID: Pick a shop ID from the dropdown menu.
- Item ID: Select an item ID from the dropdown menu.
- Click the "Predict" button.
- Instantly view the predicted sales for your selection.
- Method: POST
- Purpose: Predict sales for a given shop and item ID.
- Input:
{ "shop_id": "<shop_id>", "item_id": "<item_id>" }
- Output:
{ "prediction": <predicted_sales> }
- Method: GET
- Purpose: Fetch a list of available shop IDs.
- Output:
[<shop_id_1>, <shop_id_2>, ...]
- Method: GET
- Purpose: Fetch a list of available item IDs.
- Output:
[<item_id_1>, <item_id_2>, ...]
- Dynamic Dropdowns: Populate shop and item IDs via API calls.
- Instant Feedback: See predictions immediately after submission.
- Enhanced Visuals: Add animations and tooltips for better engagement.
- Batch Predictions: Support CSV uploads for bulk predictions.
- Data Visualization: Integrate charts to display trends and insights.
- Model Training: Include functionality to retrain the model with new data.
This project extends the Predict-Future-Sales repository. Heartfelt thanks to the contributors for providing a strong foundation for this application.
This project is licensed under the MIT License. Check the original repository for detailed licensing information.
🎉 Dive into the Predict Future Sales app and revolutionize your business decisions. Feedback and contributions are always welcome! 🌟