Spaces:
Sleeping
Sleeping
Update README.md
Browse files
README.md
CHANGED
|
@@ -10,37 +10,42 @@ license: mit
|
|
| 10 |
---
|
| 11 |
# Book Genre Predictor
|
| 12 |
|
| 13 |
-
This Space hosts a **Gradio app** that predicts the **
|
| 14 |
-
It
|
| 15 |
|
| 16 |
---
|
| 17 |
|
| 18 |
-
## Dataset & Model
|
| 19 |
|
| 20 |
-
- **
|
| 21 |
-
- **
|
| 22 |
-
- **
|
| 23 |
-
|
| 24 |
-
- `Width` (cm)
|
| 25 |
-
- `Depth` (cm, spine thickness)
|
| 26 |
-
- `Page Count` (integer)
|
| 27 |
|
| 28 |
-
|
| 29 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 30 |
|
| 31 |
-
|
|
|
|
|
|
|
| 32 |
|
| 33 |
-
|
| 34 |
|
| 35 |
-
|
| 36 |
-
2. Click **Predict** to see the modelβs prediction.
|
| 37 |
-
3. Use one of the **example inputs** to quickly test the app.
|
| 38 |
|
| 39 |
-
|
|
|
|
|
|
|
|
|
|
| 40 |
|
| 41 |
---
|
| 42 |
|
| 43 |
-
## Example
|
| 44 |
|
| 45 |
| Height (cm) | Width (cm) | Depth (cm) | Page Count |
|
| 46 |
|-------------|------------|------------|------------|
|
|
@@ -48,24 +53,45 @@ Prediction outputs are **numeric labels** (e.g., 0, 1, 2) that correspond to gen
|
|
| 48 |
| 24.0 | 15.0 | 2.2 | 320 |
|
| 49 |
| 18.5 | 12.0 | 1.5 | 180 |
|
| 50 |
|
|
|
|
|
|
|
|
|
|
| 51 |
---
|
| 52 |
|
| 53 |
-
## Technical
|
| 54 |
|
| 55 |
-
- **
|
| 56 |
-
- **
|
| 57 |
- **Deployment:** Hugging Face Spaces (`sdk: gradio`).
|
| 58 |
-
- **
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 59 |
|
| 60 |
---
|
| 61 |
|
| 62 |
-
##
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 63 |
|
| 64 |
-
|
| 65 |
-
- β
Researched and linked the **dataset/model docs**.
|
| 66 |
-
- β
Built a Gradio app with **widgets + examples**.
|
| 67 |
-
- β
Exposed inputs with validation and presented predictions clearly.
|
| 68 |
-
- β
Deployed publicly on Hugging Face Spaces with proper documentation.
|
| 69 |
|
| 70 |
---
|
| 71 |
|
|
|
|
| 10 |
---
|
| 11 |
# Book Genre Predictor
|
| 12 |
|
| 13 |
+
This Hugging Face Space hosts a **Gradio app** that predicts the **genre of a book** based on its **physical dimensions and page count**.
|
| 14 |
+
It uses a **AutoGluon Tabular model** trained during last session.
|
| 15 |
|
| 16 |
---
|
| 17 |
|
| 18 |
+
## Dataset & Model Card
|
| 19 |
|
| 20 |
+
- **Dataset:** Book metadata dataset (features: `Height`, `Width`, `Depth`, `Page Count`; label: `Genre`).
|
| 21 |
+
- **Model Repo:** [FaiyazAzam/24679-tabular-autolguon-predictor](https://huggingface.co/FaiyazAzam/24679-tabular-autolguon-predictor)
|
| 22 |
+
- **Framework:** [AutoGluon Tabular](https://auto.gluon.ai/stable/index.html)
|
| 23 |
+
- **Task:** Multi class classification -> predict `Genre` (numeric code).
|
|
|
|
|
|
|
|
|
|
| 24 |
|
| 25 |
+
### Input Features
|
| 26 |
+
| Feature | Type | Unit / Description |
|
| 27 |
+
|--------------|---------|-------------------------------------|
|
| 28 |
+
| Height | float | cm β height of the book |
|
| 29 |
+
| Width | float | cm β width of the book |
|
| 30 |
+
| Depth | float | cm β spine thickness |
|
| 31 |
+
| Page Count | integer | number of pages |
|
| 32 |
|
| 33 |
+
### Label
|
| 34 |
+
- `Genre` β encoded as **numeric codes** (e.g. 0, 1, 2, β¦).
|
| 35 |
+
- Mapping to actual names was not provided in the original dataset.
|
| 36 |
|
| 37 |
+
---
|
| 38 |
|
| 39 |
+
## App Interface
|
|
|
|
|
|
|
| 40 |
|
| 41 |
+
- **Widgets:** Numeric input boxes for each feature.
|
| 42 |
+
- **Output:** Numeric code prediction (e.g. `"Predicted Genre: 1"`).
|
| 43 |
+
- **Examples:** 3 preloaded examples for quick testing.
|
| 44 |
+
- **Validation:** Ensures all inputs are positive.
|
| 45 |
|
| 46 |
---
|
| 47 |
|
| 48 |
+
## π Example Usage
|
| 49 |
|
| 50 |
| Height (cm) | Width (cm) | Depth (cm) | Page Count |
|
| 51 |
|-------------|------------|------------|------------|
|
|
|
|
| 53 |
| 24.0 | 15.0 | 2.2 | 320 |
|
| 54 |
| 18.5 | 12.0 | 1.5 | 180 |
|
| 55 |
|
| 56 |
+
Note: The model often defaults to predicting a single genre (e.g. Fiction / code 0).
|
| 57 |
+
This reflects dataset/model limitations, not the app itself.
|
| 58 |
+
|
| 59 |
---
|
| 60 |
|
| 61 |
+
## Technical Details
|
| 62 |
|
| 63 |
+
- **Backend:** AutoGluon `TabularPredictor` loaded from a zipped artifact.
|
| 64 |
+
- **Interface:** [Gradio](https://www.gradio.app/).
|
| 65 |
- **Deployment:** Hugging Face Spaces (`sdk: gradio`).
|
| 66 |
+
- **Environment:** Python 3.10, pinned requirements.
|
| 67 |
+
|
| 68 |
+
---
|
| 69 |
+
|
| 70 |
+
## Limitations
|
| 71 |
+
|
| 72 |
+
- **Numeric labels only:** Original training dataset did not include human readable genre names.
|
| 73 |
+
- **Collapsed predictions:** Model tends to overpredict the majority class (`0`).
|
| 74 |
+
- **Generalization:** Accuracy on unseen books is uncertain due to limited feature set.
|
| 75 |
+
|
| 76 |
+
---
|
| 77 |
+
|
| 78 |
+
## Future Improvements
|
| 79 |
+
|
| 80 |
+
- Map numeric codes to the actual genre categories from the dataset.
|
| 81 |
+
- Retrain model with balanced classes.
|
| 82 |
+
- Provide confidence scores along with predictions.
|
| 83 |
+
- Explore richer book features (author, publisher, language).
|
| 84 |
|
| 85 |
---
|
| 86 |
|
| 87 |
+
## AI Disclosure
|
| 88 |
+
|
| 89 |
+
Parts of this project were supported with the help of AI tools (GPT-5), mainly for:
|
| 90 |
+
- Debugging deployment issues on Hugging Face Spaces
|
| 91 |
+
- Improving the stability of the Gradio interface
|
| 92 |
+
- Polishing documentation
|
| 93 |
|
| 94 |
+
The dataset, model training, and integration choices remain based on classmate provided artifacts and my own implementation work.
|
|
|
|
|
|
|
|
|
|
|
|
|
| 95 |
|
| 96 |
---
|
| 97 |
|