- app.py +2 -2
- requirements.txt +4 -0
app.py
CHANGED
@@ -14,8 +14,8 @@ def classify_sound(file_path):
|
|
14 |
wv, sr = torchaudio.load(file_path)
|
15 |
|
16 |
# Convert to mono
|
17 |
-
if
|
18 |
-
|
19 |
|
20 |
inputs = feature_extractor(
|
21 |
wv.squeeze().numpy(), sampling_rate=44100, return_tensors="pt"
|
|
|
14 |
wv, sr = torchaudio.load(file_path)
|
15 |
|
16 |
# Convert to mono
|
17 |
+
if wv.shape[0] > 1:
|
18 |
+
wv = wv.mean(dim=0, keepdim=True)
|
19 |
|
20 |
inputs = feature_extractor(
|
21 |
wv.squeeze().numpy(), sampling_rate=44100, return_tensors="pt"
|
requirements.txt
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
gradio
|
2 |
+
torch
|
3 |
+
torchaudio
|
4 |
+
transformers
|