Spaces:
Sleeping
Sleeping
Upload 2 files
Browse files- README.md +75 -7
- working_ast_best.pth +3 -0
README.md
CHANGED
|
@@ -1,12 +1,80 @@
|
|
| 1 |
---
|
| 2 |
-
title:
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
colorTo: red
|
| 6 |
sdk: gradio
|
| 7 |
-
|
| 8 |
app_file: app.py
|
| 9 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
---
|
| 11 |
|
| 12 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
+
title: Messy Mashup AST Genre Classifier
|
| 3 |
+
colorFrom: blue
|
| 4 |
+
colorTo: green
|
|
|
|
| 5 |
sdk: gradio
|
| 6 |
+
python_version: "3.10"
|
| 7 |
app_file: app.py
|
| 8 |
+
suggested_hardware: cpu-basic
|
| 9 |
+
fullWidth: true
|
| 10 |
+
header: default
|
| 11 |
+
short_description: Fine-tuned AST genre classifier.
|
| 12 |
+
models:
|
| 13 |
+
- MIT/ast-finetuned-audioset-10-10-0.4593
|
| 14 |
+
tags:
|
| 15 |
+
- audio-classification
|
| 16 |
+
- music
|
| 17 |
+
- gradio
|
| 18 |
+
- zero-gpu
|
| 19 |
+
- transformers
|
| 20 |
---
|
| 21 |
|
| 22 |
+
# Messy Mashup AST Genre Classifier
|
| 23 |
+
|
| 24 |
+
This folder is ready to use as the root of a CPU-only Hugging Face Space.
|
| 25 |
+
|
| 26 |
+
It contains:
|
| 27 |
+
|
| 28 |
+
- `app.py`: Gradio app with CPU-only inference
|
| 29 |
+
- `working_ast_best.pth`: your fine-tuned checkpoint
|
| 30 |
+
- `config.json` and `preprocessor_config.json`: local AST config so the Space does not need to fetch them at startup
|
| 31 |
+
- `requirements.txt`: Python dependencies for the Space
|
| 32 |
+
- `.gitattributes`: Git LFS rules for the checkpoint
|
| 33 |
+
|
| 34 |
+
## What The App Does
|
| 35 |
+
|
| 36 |
+
The app accepts an uploaded audio clip or microphone recording and predicts one of these 10 genres:
|
| 37 |
+
|
| 38 |
+
- blues
|
| 39 |
+
- classical
|
| 40 |
+
- country
|
| 41 |
+
- disco
|
| 42 |
+
- hiphop
|
| 43 |
+
- jazz
|
| 44 |
+
- metal
|
| 45 |
+
- pop
|
| 46 |
+
- reggae
|
| 47 |
+
- rock
|
| 48 |
+
|
| 49 |
+
The preprocessing follows your AST notebook flow:
|
| 50 |
+
|
| 51 |
+
1. Convert to mono
|
| 52 |
+
2. Resample to 16 kHz
|
| 53 |
+
3. Pad or crop to 10 seconds
|
| 54 |
+
4. RMS normalize and clamp
|
| 55 |
+
5. Run the AST feature extractor
|
| 56 |
+
6. Predict the genre with the fine-tuned checkpoint
|
| 57 |
+
|
| 58 |
+
## Deploy To Hugging Face Spaces
|
| 59 |
+
|
| 60 |
+
1. Create a new Hugging Face Space and choose the `Gradio` SDK.
|
| 61 |
+
2. Copy the contents of this folder into the Space repository root.
|
| 62 |
+
3. Make sure `git-lfs` is installed before pushing because `working_ast_best.pth` is large.
|
| 63 |
+
4. In the Space settings, use `CPU Basic` or `CPU Upgrade`.
|
| 64 |
+
|
| 65 |
+
## CPU Deployment Notes
|
| 66 |
+
|
| 67 |
+
This app is set up for standard CPU execution:
|
| 68 |
+
|
| 69 |
+
- no `spaces` package is required
|
| 70 |
+
- no `@spaces.GPU` decorator is used
|
| 71 |
+
- the model is loaded on CPU and inference runs on CPU only
|
| 72 |
+
|
| 73 |
+
For a first deployment, this is simpler than ZeroGPU and avoids queueing and GPU quota issues.
|
| 74 |
+
|
| 75 |
+
## Local Run
|
| 76 |
+
|
| 77 |
+
```bash
|
| 78 |
+
pip install -r requirements.txt
|
| 79 |
+
python app.py
|
| 80 |
+
```
|
working_ast_best.pth
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:5e2bdd925462b7f57d1ea0695736f865db331f517453fd20d45e46296ac8be9e
|
| 3 |
+
size 344878330
|