Spaces:
Sleeping
Sleeping
| # AI-Based Diamond Price Prediction and Classification | |
| This project utilizes **machine learning and AI techniques** to predict **diamond grading prices** (GIA-certified prices, grading prices, and bygrading prices) based on various diamond attributes. Additionally, it provides classification-based recommendations for changes in diamond parameters. The system is built using **Flask**, **scikit-learn**, and **XGBoost**, and it is deployed as a web application with a user-friendly interface. | |
| --- | |
| ## π Project Overview | |
| ### Problem Statement | |
| Manually evaluating diamond prices and certification costs is a **time-consuming and error-prone** task. This project automates the process by leveraging AI models to analyze historical data and provide **accurate predictions and recommendations** based on diamond attributes. | |
| ### Key Features | |
| β **Diamond Price Prediction**: Predicts GIA, grading, and bygrading prices using AI. | |
| β **Parameter Change Analysis**: Identifies and suggests modifications in diamond attributes. | |
| β **Automated Data Processing**: Cleans and preprocesses input data for better model accuracy. | |
| β **Web-Based Interface**: Flask-based UI for easy file uploads and result visualization. | |
| β **Downloadable Reports**: Users can download CSV reports for predictions and analysis. | |
| --- | |
| ## βοΈ Tech Stack | |
| | Component | Tools/Technologies Used | | |
| |---------------|----------------------| | |
| | **Backend** | Flask, scikit-learn, XGBoost, NumPy, Pandas | | |
| | **Frontend** | HTML, CSS, Jinja Templates | | |
| | **Database** | CSV/Excel file-based input | | |
| | **Deployment** | Docker, Gunicorn | | |
| | **Machine Learning** | Linear Regression, Decision Trees, Random Forest, K-Nearest Neighbors, XGBoost | | |
| --- | |
| ## π Project Workflow | |
| ### πΉ Input: | |
| - Users upload a CSV/Excel file containing **diamond attributes** (Tag, Carat, Shape, Quality, Color, Cut, Polish, Symmetry, Fluorescence, etc.). | |
| ### πΉ Processing: | |
| - **Prediction Models** estimate GIA prices, grading prices, and bygrading prices. | |
| - **Classification Models** analyze changes in diamond parameters (e.g., carat, color, cut). | |
| ### πΉ Output: | |
| - Users receive **predicted values** and **recommendations** based on AI models. | |
| - Results are displayed in a structured table. | |
| - Users can **download reports** as CSV files. | |
| --- | |
| ## π οΈ Setup Instructions | |
| ### 1οΈβ£ Clone the Repository | |
| ```bash | |
| git clone https://huggingface.co/spaces/WebashalarForML/DiamRapo | |
| cd diamond-price-prediction | |
| ``` | |
| ### 2οΈβ£ Create a Virtual Environment (Optional) | |
| ```bash | |
| python -m venv venv | |
| source venv/bin/activate # On Windows: venv\Scripts\activate | |
| ``` | |
| ### 3οΈβ£ Install Dependencies | |
| ```bash | |
| pip install -r requirements.txt | |
| ``` | |
| ### 4οΈβ£ Run the Application | |
| ```bash | |
| python app.py | |
| ``` | |
| Visit `http://127.0.0.1:5000` in your browser. | |
| --- | |
| ## π¦ Running with Docker | |
| ### 1οΈβ£ Build the Docker Image | |
| ```bash | |
| docker build -t diamond-prediction . | |
| ``` | |
| ### 2οΈβ£ Run the Container | |
| ```bash | |
| docker run -p 7860:7860 diamond-prediction | |
| ``` | |
| Now, visit `http://localhost:7860` to use the app. | |
| --- | |
| ## π API Endpoints | |
| | Endpoint | Method | Description | | |
| |----------|--------|-------------| | |
| | `/` | GET | Home page | | |
| | `/predict` | POST | Uploads a CSV/Excel file and predicts diamond prices | | |
| | `/download_pred` | GET | Downloads prediction results as CSV | | |
| | `/download_class` | GET | Downloads classification analysis as CSV | | |
| --- | |
| ## π Project Structure | |
| ``` | |
| . | |
| βββ app.py # Flask application | |
| βββ templates/ | |
| β βββ index.html # Home page template | |
| β βββ output.html # Output display template | |
| βββ static/ # CSS and static files | |
| βββ Model/ # Trained ML models (.joblib) | |
| βββ Label_encoders/ # Pretrained label encoders | |
| βββ uploads/ # Uploaded files storage | |
| βββ data/ # Processed data files | |
| βββ requirements.txt # Dependencies list | |
| βββ Dockerfile # Docker setup | |
| βββ README.md # Documentation | |
| ``` | |
| --- | |
| ## π Example Use Cases | |
| ### 1οΈβ£ Predicting Diamond Prices | |
| - Upload a **diamond dataset (CSV/Excel)**. | |
| - The AI model predicts **GIA price, grading price, and bygrading price**. | |
| - Download the results as a structured report. | |
| ### 2οΈβ£ Identifying Diamond Parameter Changes | |
| - AI analyzes changes in **carat, cut, color, and other attributes**. | |
| - Alerts users to potential modifications in the diamond properties. | |
| --- | |
| ## π Future Enhancements | |
| - β Improve model accuracy with deep learning. | |
| - β Add support for **real-time API integration** with diamond pricing databases. | |
| - β Extend the system to predict **market trends** using time-series forecasting. | |
| --- | |
| ## π‘ Credits | |
| Developed by **Webashlar**, a leading IT company specializing in AI, data science, and software solutions. | |
| Happy predicting! πβ¨ | |
| --- | |