Spaces:
Running
Running
Update README2.md
Browse files- README2.md +96 -64
README2.md
CHANGED
@@ -1,122 +1,154 @@
|
|
1 |
# AI-Based Diamond Price Prediction and Classification
|
2 |
|
3 |
-
This project
|
4 |
|
5 |
---
|
6 |
|
7 |
## π Project Overview
|
8 |
|
9 |
-
|
|
|
10 |
|
11 |
-
###
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
-
|
|
|
16 |
|
17 |
---
|
18 |
|
19 |
-
##
|
20 |
|
21 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
22 |
|
23 |
---
|
24 |
|
25 |
-
##
|
26 |
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
|
|
|
|
|
|
|
|
34 |
|
35 |
---
|
36 |
|
37 |
-
##
|
38 |
|
39 |
-
### 1οΈβ£
|
|
|
|
|
|
|
|
|
|
|
|
|
40 |
```bash
|
41 |
python -m venv venv
|
42 |
source venv/bin/activate # On Windows: venv\Scripts\activate
|
43 |
```
|
44 |
|
45 |
-
###
|
46 |
```bash
|
47 |
pip install -r requirements.txt
|
48 |
```
|
49 |
|
50 |
-
###
|
51 |
```bash
|
52 |
python app.py
|
53 |
```
|
54 |
-
|
55 |
-
OR (if using Docker)
|
56 |
-
```bash
|
57 |
-
docker-compose up --build
|
58 |
-
```
|
59 |
|
60 |
---
|
61 |
|
62 |
-
##
|
63 |
|
64 |
-
###
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
**Process:**
|
69 |
-
1. **Historical Learning:** AI model learns from past diamond data.
|
70 |
-
2. **Training:** Identifies patterns linking diamond attributes to final pricing.
|
71 |
-
3. **Deployment:** Predicts `GrdAmt, ByGrdAmt, GiaAmt` for new inputs.
|
72 |
|
73 |
-
|
74 |
-
|
|
|
|
|
|
|
75 |
|
76 |
---
|
77 |
|
78 |
-
|
79 |
-
**Input:** Engineer Plan data with additional attributes:
|
80 |
-
`Tag, EngCts, EngShp, EngQua, EngCol, EngCut, EngPol, EngSym, EngFlo, EngNts, EngMikly, EngLab, EngAmt, Carat, Black_Code, White_Code`
|
81 |
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
|
89 |
---
|
90 |
|
91 |
-
## π
|
92 |
|
93 |
```
|
94 |
.
|
95 |
βββ app.py # Flask application
|
96 |
βββ templates/
|
97 |
-
β βββ index.html
|
98 |
-
β βββ output.html
|
99 |
-
βββ
|
100 |
-
βββ Model/
|
101 |
-
βββ Label_encoders/
|
102 |
-
βββ
|
103 |
-
βββ
|
104 |
-
βββ
|
|
|
|
|
105 |
```
|
106 |
|
107 |
---
|
108 |
|
109 |
-
##
|
110 |
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
|
|
|
|
|
|
116 |
|
117 |
---
|
118 |
|
119 |
-
##
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
120 |
|
121 |
-
| Endpoint | Method | Description |
|
122 |
-
|----------|--------|-------------
|
|
|
1 |
# AI-Based Diamond Price Prediction and Classification
|
2 |
|
3 |
+
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.
|
4 |
|
5 |
---
|
6 |
|
7 |
## π Project Overview
|
8 |
|
9 |
+
### Problem Statement
|
10 |
+
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.
|
11 |
|
12 |
+
### Key Features
|
13 |
+
β
**Diamond Price Prediction**: Predicts GIA, grading, and bygrading prices using AI.
|
14 |
+
β
**Parameter Change Analysis**: Identifies and suggests modifications in diamond attributes.
|
15 |
+
β
**Automated Data Processing**: Cleans and preprocesses input data for better model accuracy.
|
16 |
+
β
**Web-Based Interface**: Flask-based UI for easy file uploads and result visualization.
|
17 |
+
β
**Downloadable Reports**: Users can download CSV reports for predictions and analysis.
|
18 |
|
19 |
---
|
20 |
|
21 |
+
## βοΈ Tech Stack
|
22 |
|
23 |
+
| Component | Tools/Technologies Used |
|
24 |
+
|---------------|----------------------|
|
25 |
+
| **Backend** | Flask, scikit-learn, XGBoost, NumPy, Pandas |
|
26 |
+
| **Frontend** | HTML, CSS, Jinja Templates |
|
27 |
+
| **Database** | CSV/Excel file-based input |
|
28 |
+
| **Deployment** | Docker, Gunicorn |
|
29 |
+
| **Machine Learning** | Linear Regression, Decision Trees, Random Forest, K-Nearest Neighbors, XGBoost |
|
30 |
|
31 |
---
|
32 |
|
33 |
+
## π Project Workflow
|
34 |
|
35 |
+
### πΉ Input:
|
36 |
+
- Users upload a CSV/Excel file containing **diamond attributes** (Tag, Carat, Shape, Quality, Color, Cut, Polish, Symmetry, Fluorescence, etc.).
|
37 |
+
|
38 |
+
### πΉ Processing:
|
39 |
+
- **Prediction Models** estimate GIA prices, grading prices, and bygrading prices.
|
40 |
+
- **Classification Models** analyze changes in diamond parameters (e.g., carat, color, cut).
|
41 |
+
|
42 |
+
### πΉ Output:
|
43 |
+
- Users receive **predicted values** and **recommendations** based on AI models.
|
44 |
+
- Results are displayed in a structured table.
|
45 |
+
- Users can **download reports** as CSV files.
|
46 |
|
47 |
---
|
48 |
|
49 |
+
## π οΈ Setup Instructions
|
50 |
|
51 |
+
### 1οΈβ£ Clone the Repository
|
52 |
+
```bash
|
53 |
+
git clone https://github.com/your-repo/diamond-price-prediction.git
|
54 |
+
cd diamond-price-prediction
|
55 |
+
```
|
56 |
+
|
57 |
+
### 2οΈβ£ Create a Virtual Environment (Optional)
|
58 |
```bash
|
59 |
python -m venv venv
|
60 |
source venv/bin/activate # On Windows: venv\Scripts\activate
|
61 |
```
|
62 |
|
63 |
+
### 3οΈβ£ Install Dependencies
|
64 |
```bash
|
65 |
pip install -r requirements.txt
|
66 |
```
|
67 |
|
68 |
+
### 4οΈβ£ Run the Application
|
69 |
```bash
|
70 |
python app.py
|
71 |
```
|
72 |
+
Visit `http://127.0.0.1:5000` in your browser.
|
|
|
|
|
|
|
|
|
73 |
|
74 |
---
|
75 |
|
76 |
+
## π¦ Running with Docker
|
77 |
|
78 |
+
### 1οΈβ£ Build the Docker Image
|
79 |
+
```bash
|
80 |
+
docker build -t diamond-prediction .
|
81 |
+
```
|
|
|
|
|
|
|
|
|
82 |
|
83 |
+
### 2οΈβ£ Run the Container
|
84 |
+
```bash
|
85 |
+
docker run -p 7860:7860 diamond-prediction
|
86 |
+
```
|
87 |
+
Now, visit `http://localhost:7860` to use the app.
|
88 |
|
89 |
---
|
90 |
|
91 |
+
## π API Endpoints
|
|
|
|
|
92 |
|
93 |
+
| Endpoint | Method | Description |
|
94 |
+
|----------|--------|-------------|
|
95 |
+
| `/` | GET | Home page |
|
96 |
+
| `/predict` | POST | Uploads a CSV/Excel file and predicts diamond prices |
|
97 |
+
| `/download_pred` | GET | Downloads prediction results as CSV |
|
98 |
+
| `/download_class` | GET | Downloads classification analysis as CSV |
|
99 |
|
100 |
---
|
101 |
|
102 |
+
## π Project Structure
|
103 |
|
104 |
```
|
105 |
.
|
106 |
βββ app.py # Flask application
|
107 |
βββ templates/
|
108 |
+
β βββ index.html # Home page template
|
109 |
+
β βββ output.html # Output display template
|
110 |
+
βββ static/ # CSS and static files
|
111 |
+
βββ Model/ # Trained ML models (.joblib)
|
112 |
+
βββ Label_encoders/ # Pretrained label encoders
|
113 |
+
βββ uploads/ # Uploaded files storage
|
114 |
+
βββ data/ # Processed data files
|
115 |
+
βββ requirements.txt # Dependencies list
|
116 |
+
βββ Dockerfile # Docker setup
|
117 |
+
βββ README.md # Documentation
|
118 |
```
|
119 |
|
120 |
---
|
121 |
|
122 |
+
## π Example Use Cases
|
123 |
|
124 |
+
### 1οΈβ£ Predicting Diamond Prices
|
125 |
+
- Upload a **diamond dataset (CSV/Excel)**.
|
126 |
+
- The AI model predicts **GIA price, grading price, and bygrading price**.
|
127 |
+
- Download the results as a structured report.
|
128 |
+
|
129 |
+
### 2οΈβ£ Identifying Diamond Parameter Changes
|
130 |
+
- AI analyzes changes in **carat, cut, color, and other attributes**.
|
131 |
+
- Alerts users to potential modifications in the diamond properties.
|
132 |
|
133 |
---
|
134 |
|
135 |
+
## π Future Enhancements
|
136 |
+
- β
Improve model accuracy with deep learning.
|
137 |
+
- β
Add support for **real-time API integration** with diamond pricing databases.
|
138 |
+
- β
Extend the system to predict **market trends** using time-series forecasting.
|
139 |
+
|
140 |
+
---
|
141 |
+
|
142 |
+
## π License
|
143 |
+
This project is licensed under the **MIT License**.
|
144 |
+
|
145 |
+
---
|
146 |
+
|
147 |
+
## π‘ Credits
|
148 |
+
Developed by **Webashlar**, a leading IT company specializing in AI, data science, and software solutions.
|
149 |
+
|
150 |
+
Happy predicting! πβ¨
|
151 |
+
```
|
152 |
+
|
153 |
+
---
|
154 |
|
|
|
|