Arsala Grey
commited on
Commit
·
459c202
1
Parent(s):
c6e555b
new sounds to classify
Browse files- clear-audio-1.wav +0 -0
- clear-audio-2.wav +0 -0
- index.html +3 -3
- index.js +8 -4
- sounds/airplane-landing.mp3 +0 -0
- sounds/alien-spaceship.mp3 +0 -0
- sounds/hard_shoes.mp3 +0 -0
- sounds/labrador-barking.mp3 +0 -0
- sounds/old-car-engine.mp3 +0 -0
- sounds/tolling-bell.mp3 +0 -0
- unclear-audio-1.wav +0 -0
- unclear-audio-2.wav +0 -0
clear-audio-1.wav
DELETED
|
Binary file (483 kB)
|
|
|
clear-audio-2.wav
DELETED
|
Binary file (469 kB)
|
|
|
index.html
CHANGED
|
@@ -32,7 +32,7 @@
|
|
| 32 |
</div>
|
| 33 |
<div class="grid grid-cols-2 gap-2">
|
| 34 |
<div>
|
| 35 |
-
<label for="audio-select">Select an audio</label>
|
| 36 |
<select id="audio-select" v-model="selectedAudio">
|
| 37 |
<option v-for="audioFile in audioFiles" :value="audioFile">
|
| 38 |
{{ audioFile }}
|
|
@@ -41,10 +41,10 @@
|
|
| 41 |
</div>
|
| 42 |
<div>
|
| 43 |
<label id="audio-label">Audio Player</label>
|
| 44 |
-
<audio id="audio" controls :src="selectedAudio"></audio>
|
| 45 |
</div>
|
| 46 |
</div>
|
| 47 |
-
<button class="btn-success" @click="run">
|
| 48 |
<h3>{{statusMessage}}</h3>
|
| 49 |
<table v-if="classificationLabels.length > 0">
|
| 50 |
<thead>
|
|
|
|
| 32 |
</div>
|
| 33 |
<div class="grid grid-cols-2 gap-2">
|
| 34 |
<div>
|
| 35 |
+
<label for="audio-select">Select an audio (Credits: Daniel Simion - SoundBible)</label>
|
| 36 |
<select id="audio-select" v-model="selectedAudio">
|
| 37 |
<option v-for="audioFile in audioFiles" :value="audioFile">
|
| 38 |
{{ audioFile }}
|
|
|
|
| 41 |
</div>
|
| 42 |
<div>
|
| 43 |
<label id="audio-label">Audio Player</label>
|
| 44 |
+
<audio id="audio" controls :src="`sounds/${selectedAudio}`"></audio>
|
| 45 |
</div>
|
| 46 |
</div>
|
| 47 |
+
<button class="btn-success" @click="run">CLASSIFY</button>
|
| 48 |
<h3>{{statusMessage}}</h3>
|
| 49 |
<table v-if="classificationLabels.length > 0">
|
| 50 |
<thead>
|
index.js
CHANGED
|
@@ -5,12 +5,16 @@ const app = createApp({
|
|
| 5 |
setup() {
|
| 6 |
const token = ref(localStorage.getItem("token") || "");
|
| 7 |
const models = ref(["MIT/ast-finetuned-audioset-10-10-0.4593"]);
|
| 8 |
-
const selectedAudio = ref("
|
| 9 |
const selectedModel = ref("");
|
| 10 |
const loading = ref(false);
|
| 11 |
const didErrorOccur = ref(false)
|
| 12 |
-
const audioFiles = ref([
|
| 13 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
const classificationLabels = ref([])
|
| 15 |
|
| 16 |
|
|
@@ -24,7 +28,7 @@ const app = createApp({
|
|
| 24 |
loading.value = true;
|
| 25 |
try {
|
| 26 |
const hf = new HfInference(token.value);
|
| 27 |
-
const audioData = await (await fetch(selectedAudio.value)).arrayBuffer()
|
| 28 |
const result = await hf.audioClassification({
|
| 29 |
data: audioData,
|
| 30 |
model: selectedModel.value
|
|
|
|
| 5 |
setup() {
|
| 6 |
const token = ref(localStorage.getItem("token") || "");
|
| 7 |
const models = ref(["MIT/ast-finetuned-audioset-10-10-0.4593"]);
|
| 8 |
+
const selectedAudio = ref("airplane-landing.mp3");
|
| 9 |
const selectedModel = ref("");
|
| 10 |
const loading = ref(false);
|
| 11 |
const didErrorOccur = ref(false)
|
| 12 |
+
const audioFiles = ref(['airplane-landing.mp3',
|
| 13 |
+
'alien-spaceship.mp3',
|
| 14 |
+
'hard_shoes.mp3',
|
| 15 |
+
'labrador-barking.mp3',
|
| 16 |
+
'old-car-engine.mp3',
|
| 17 |
+
'tolling-bell.mp3']);
|
| 18 |
const classificationLabels = ref([])
|
| 19 |
|
| 20 |
|
|
|
|
| 28 |
loading.value = true;
|
| 29 |
try {
|
| 30 |
const hf = new HfInference(token.value);
|
| 31 |
+
const audioData = await (await fetch(`sounds/${selectedAudio.value}`)).arrayBuffer()
|
| 32 |
const result = await hf.audioClassification({
|
| 33 |
data: audioData,
|
| 34 |
model: selectedModel.value
|
sounds/airplane-landing.mp3
ADDED
|
Binary file (227 kB). View file
|
|
|
sounds/alien-spaceship.mp3
ADDED
|
Binary file (270 kB). View file
|
|
|
sounds/hard_shoes.mp3
ADDED
|
Binary file (73 kB). View file
|
|
|
sounds/labrador-barking.mp3
ADDED
|
Binary file (344 kB). View file
|
|
|
sounds/old-car-engine.mp3
ADDED
|
Binary file (328 kB). View file
|
|
|
sounds/tolling-bell.mp3
ADDED
|
Binary file (323 kB). View file
|
|
|
unclear-audio-1.wav
DELETED
|
Binary file (480 kB)
|
|
|
unclear-audio-2.wav
DELETED
|
Binary file (473 kB)
|
|
|