Update README.md
Browse files
README.md
CHANGED
@@ -12,6 +12,7 @@ language:
|
|
12 |
- es
|
13 |
- el
|
14 |
- fr
|
|
|
15 |
metrics:
|
16 |
- bertscore
|
17 |
base_model:
|
@@ -32,6 +33,8 @@ tags:
|
|
32 |
|
33 |
This model is designed to classify audio clips into two categories: "Suno" music or "People" music. It is trained on a dataset containing examples of both types of music and can be used for various applications such as music recommendation, genre classification, and more.
|
34 |
|
|
|
|
|
35 |
## Model Details
|
36 |
|
37 |
- **Model Name:** `felguk-suno-or-people`
|
@@ -39,27 +42,44 @@ This model is designed to classify audio clips into two categories: "Suno" music
|
|
39 |
- **Input:** Audio clip (WAV format)
|
40 |
- **Output:** Classification label (`suno` or `people`)
|
41 |
|
|
|
|
|
42 |
## Usage
|
43 |
|
44 |
-
|
45 |
|
46 |
-
|
47 |
-
from transformers import pipeline
|
48 |
|
49 |
-
|
50 |
-
classifier = pipeline("audio-classification", model="Felguk/Felguk-suno-or-people")
|
51 |
|
52 |
-
|
53 |
-
|
54 |
-
print(result)
|
55 |
```
|
56 |
-
##
|
57 |
```bash
|
58 |
-
|
|
|
|
|
|
|
|
|
|
|
59 |
```
|
60 |
-
#### example
|
61 |
```bash
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
- es
|
13 |
- el
|
14 |
- fr
|
15 |
+
- ae
|
16 |
metrics:
|
17 |
- bertscore
|
18 |
base_model:
|
|
|
33 |
|
34 |
This model is designed to classify audio clips into two categories: "Suno" music or "People" music. It is trained on a dataset containing examples of both types of music and can be used for various applications such as music recommendation, genre classification, and more.
|
35 |
|
36 |
+
---
|
37 |
+
|
38 |
## Model Details
|
39 |
|
40 |
- **Model Name:** `felguk-suno-or-people`
|
|
|
42 |
- **Input:** Audio clip (WAV format)
|
43 |
- **Output:** Classification label (`suno` or `people`)
|
44 |
|
45 |
+
---
|
46 |
+
|
47 |
## Usage
|
48 |
|
49 |
+
This model is not currently available via third-party inference providers or the Hugging Face Inference API. However, you can easily use it locally by following the steps below.
|
50 |
|
51 |
+
### Step 1: Install Required Libraries
|
|
|
52 |
|
53 |
+
Make sure you have the `transformers` and `datasets` libraries installed:
|
|
|
54 |
|
55 |
+
```bash
|
56 |
+
pip install transformers datasets
|
|
|
57 |
```
|
58 |
+
## load model
|
59 |
```bash
|
60 |
+
from transformers import AutoModelForAudioClassification, AutoFeatureExtractor
|
61 |
+
import torch
|
62 |
+
|
63 |
+
# Load the model and feature extractor
|
64 |
+
model = AutoModelForAudioClassification.from_pretrained("Felguk/Felguk-suno-or-people")
|
65 |
+
feature_extractor = AutoFeatureExtractor.from_pretrained("Felguk/Felguk-suno-or-people")
|
66 |
```
|
|
|
67 |
```bash
|
68 |
+
from datasets import load_dataset, Audio
|
69 |
+
|
70 |
+
# Load an example audio file (replace with your own file)
|
71 |
+
dataset = load_dataset("common_voice", "en", split="train", streaming=True)
|
72 |
+
audio_sample = next(iter(dataset))["audio"]
|
73 |
+
|
74 |
+
# Preprocess the audio
|
75 |
+
inputs = feature_extractor(audio_sample["array"], sampling_rate=audio_sample["sampling_rate"], return_tensors="pt")
|
76 |
+
```
|
77 |
+
```bash
|
78 |
+
# Perform inference
|
79 |
+
with torch.no_grad():
|
80 |
+
logits = model(**inputs).logits
|
81 |
+
|
82 |
+
# Get the predicted label
|
83 |
+
predicted_class_id = logits.argmax().item()
|
84 |
+
label = model.config.id2label[predicted_class_id]
|
85 |
+
print(f"Predicted label: {label}")
|