init
Browse files- 808.wav +0 -0
- acid.wav +0 -0
- app.py +23 -0
- brass.wav +0 -0
- growl.wav +0 -0
- jump_up.wav +0 -0
- requirements.txt +4 -0
- slap.wav +0 -0
808.wav
ADDED
Binary file (226 kB). View file
|
|
acid.wav
ADDED
Binary file (114 kB). View file
|
|
app.py
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
import numpy as np
|
3 |
+
import librosa
|
4 |
+
from transformers import pipeline
|
5 |
+
|
6 |
+
pipe = pipeline("audio-classification", model="TheDuyx/distilhubert-bass-classifier")
|
7 |
+
|
8 |
+
def classify_audio(filepath):
|
9 |
+
audio, sampling_rate = librosa.load(filepath, sr=16_000)
|
10 |
+
preds = pipe(audio)
|
11 |
+
outputs = {}
|
12 |
+
for p in preds:
|
13 |
+
outputs[p["label"]] = p["score"]
|
14 |
+
return outputs
|
15 |
+
|
16 |
+
demo = gr.Interface(
|
17 |
+
fn=classify_audio,
|
18 |
+
inputs=gr.Audio(type="filepath"),
|
19 |
+
outputs="label",
|
20 |
+
examples=[["brass.wav"], ["growl.wav"], ["808.wav"], ["acid.wav"] ["jump_up.wav"], ["slap.wav"]],
|
21 |
+
)
|
22 |
+
|
23 |
+
demo.launch()
|
brass.wav
ADDED
Binary file (401 kB). View file
|
|
growl.wav
ADDED
Binary file (212 kB). View file
|
|
jump_up.wav
ADDED
Binary file (137 kB). View file
|
|
requirements.txt
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
torch
|
2 |
+
transformers
|
3 |
+
librosa
|
4 |
+
numpy
|
slap.wav
ADDED
Binary file (128 kB). View file
|
|