Spaces:
Running
Running
File size: 3,256 Bytes
900ed64 |
1 2 3 4 5 6 7 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 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 |
---
title: FastAPI Model
sdk: docker
emoji: π
colorFrom: blue
colorTo: purple
pinned: false
---
<<<<<<< HEAD
# AI-Powered Body Measurement & Apparel Sizing
This project is a **FastAPI-based AI system** that predicts **body measurements** and recommends **clothing sizes** using deep learning. It processes **front and side images**, removes backgrounds, and utilizes a trained **Keras model** for accurate predictions.
---
## π Features
β
AI-powered **body measurement estimation** using images.
β
Automatic **background removal** for clean image processing.
β
Deep learning-based **predictions** using a trained model.
β
**FastAPI integration** for quick and efficient API responses.
---
## π Installation
To set up the project, follow these steps:
### **1οΈβ£ Clone the Repository**
```bash
git clone https://github.com/CloozyBrands/AI-BodyMeasurement.git
```
---
### **2οΈβ£ Install Dependencies**
```bash
pip install -r requirements.txt
```
### **3οΈβ£ Run the FastAPI Server**
```bash
uvicorn app.main:app --reload
```
Then open **http://127.0.0.1:8000/docs** to test the API.
---
## π οΈ How It Works
### **1οΈβ£ Upload Images**
- The API accepts **two images**:
- **Front view**
- **Side view**
### **2οΈβ£ AI-Based Processing**
- The images are processed using **`single_person_processor.py`**, which:
β
Removes the background using `rembg`.
β
Converts the images into a **model-compatible format**.
β
Predicts **body measurements** like chest, waist, and height.
### **3οΈβ£ Clothing Size Prediction**
- Based on the body measurements, the system suggests a **T-shirt and pants size** using predefined **size charts**.
---
## π API Endpoints
### **1οΈβ£ `/predict/` (POST) - Predict Body Measurements**
π **Example Request:**
```http
POST /predict/
```
π **Request Parameters:**
| Parameter | Type | Description |
|---------------|--------|-------------|
| `front_image` | File | Front view image (JPEG/PNG) |
| `side_image` | File | Side view image (JPEG/PNG) |
| `input_data` | JSON | User data (height, weight, gender) |
π **Example JSON Payload:**
```json
{
"gender": 0,
"height_cm": 175,
"weight_kg": 70,
"apparel_type": "all"
}
```
π **Example Response:**
```json
{
"results": {
"body_measurements": {
"chest": 100.5,
"waist": 80.2,
"hip": 97.3
},
"tshirt_size": "L",
"pants_size": 34
}
}
```
---
## π― Model & AI Processing
π The model used in this project is a **TensorFlow/Keras** model stored as `best_model.keras`.
π The AI processing is handled inside **`single_person_processor.py`**, which:
- Loads the trained model using `tf.keras.models.load_model`.
- Extracts measurements based on input images.
- Maps the measurements to standard clothing sizes.
---
## π License
This project is licensed under the **MIT License** β feel free to modify and use it.
---
## π€ Contributing
1. Fork the repository
2. Create a new branch
3. Make your changes
4. Submit a pull request
We welcome contributions and improvements! π
```
>>>>>>> 4e80050 (FastAPI model for size recommendation) |