CoolFace
Apppublic

eyasir2047/e-waste_price_estimation

sourceHugging Facemitupdated 10mo agoView on Hugging Face
0likes
App README

E-Waste Price Estimation API

A machine learning API for predicting resale prices of electronic waste (e-waste) items using an ensemble of LightGBM models.

๐Ÿš€ API Endpoints

Base URL

https://eyasir2047-e-waste-price-estimation.hf.space

Endpoints

1. Root
bash
GET /
2. Health Check
bash
GET /health
3. Single Prediction
bash
POST /predict

Request Body:

json
{
  "product_type": "Laptop",
  "brand": "Dell",
  "build_quality": 8,
  "user_lifespan": 5.0,
  "usage_pattern": "Heavy",
  "expiry_years": 3.0,
  "condition": 7,
  "original_price": 50000.0,
  "used_duration": 2
}

Response:

json
{
  "predicted_price": 25000.50
}
4. Batch Prediction
bash
POST /predict/batch

Request Body:

json
{
  "items": [
    {
      "product_type": "Laptop",
      "brand": "Dell",
      "build_quality": 8,
      "user_lifespan": 5.0,
      "usage_pattern": "Heavy",
      "expiry_years": 3.0,
      "condition": 7,
      "original_price": 50000.0,
      "used_duration": 2
    }
  ]
}

Response:

json
{
  "predictions": [25000.50]
}

๐Ÿ“ Usage Examples

cURL

bash
curl -X POST "https://eyasir2047-e-waste-price-estimation.hf.space/predict" \
     -H "Content-Type: application/json" \
     -d '{
       "product_type": "Laptop",
       "brand": "Dell",
       "build_quality": 8,
       "user_lifespan": 5.0,
       "usage_pattern": "Heavy",
       "expiry_years": 3.0,
       "condition": 7,
       "original_price": 50000.0,
       "used_duration": 2
     }'

Python

python
import requests

url = "https://eyasir2047-e-waste-price-estimation.hf.space/predict"
data = {
    "product_type": "Laptop",
    "brand": "Dell",
    "build_quality": 8,
    "user_lifespan": 5.0,
    "usage_pattern": "Heavy",
    "expiry_years": 3.0,
    "condition": 7,
    "original_price": 50000.0,
    "used_duration": 2
}

response = requests.post(url, json=data)
print(response.json())

JavaScript

javascript
fetch('https://eyasir2047-e-waste-price-estimation.hf.space/predict', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    product_type: "Laptop",
    brand: "Dell",
    build_quality: 8,
    user_lifespan: 5.0,
    usage_pattern: "Heavy",
    expiry_years: 3.0,
    condition: 7,
    original_price: 50000.0,
    used_duration: 2
  })
})
.then(response => response.json())
.then(data => console.log(data));

๐ŸŽฏ Input Parameters

ParameterTypeDescriptionExample
product_typestringType of electronic product"Laptop", "Phone", "Tablet"
brandstringBrand name"Dell", "Apple", "Samsung"
build_qualityintBuild quality rating (1-10)8
user_lifespanfloatExpected lifespan in years5.0
usage_patternstringUsage intensity"Light", "Medium", "Heavy"
expiry_yearsfloatYears until expiry3.0
conditionintCurrent condition rating (1-10)7
original_pricefloatOriginal purchase price50000.0
used_durationintYears of usage2

๐Ÿ”ง Model Details

  • โ€”Algorithm: LightGBM Ensemble (5-fold cross-validation)
  • โ€”Features: 20+ engineered features including depreciation rates, age ratios, and interaction terms
  • โ€”Target: Resale price prediction (log-transformed)

๐Ÿ“š Interactive Documentation

Visit /docs for interactive Swagger UI documentation:

https://eyasir2047-e-waste-price-estimation.hf.space/docs

๐Ÿ› ๏ธ Technology Stack

  • โ€”FastAPI
  • โ€”LightGBM
  • โ€”Pandas
  • โ€”NumPy
  • โ€”Scikit-learn
  • โ€”Uvicorn

๐Ÿ“„ License

MIT