File size: 2,285 Bytes
e4fe4ed c6e555b 459c202 c6e555b 459c202 c6e555b 459c202 c6e555b e4fe4ed |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width" />
<title>Audio Classification Vue - HuggingFace.js Live Examples</title>
<link rel="stylesheet" href="pico.classless.min.css" />
<link rel="stylesheet" href="main.css" />
<script src="https://unpkg.com/vue@3/dist/vue.global.js"></script>
</head>
<body>
<div id="app" class="container">
<h1>Audio Classification</h1>
<div class="grid grid-cols-2 gap-2">
<div>
<label for="hf-token"
>Hugging Face Token (optional but limited if absent)</label
>
<input
id="hf-token"
v-model="token"
placeholder="HF-TOKEN"
type="password"
/>
</div>
<div>
<label for="model-select">Select a model</label>
<select id="model-select" v-model="selectedModel">
<option v-for="model in models" :value="model">{{ model }}</option>
</select>
</div>
</div>
<div class="grid grid-cols-2 gap-2">
<div>
<label for="audio-select">Select an audio (Credits: Daniel Simion - SoundBible)</label>
<select id="audio-select" v-model="selectedAudio">
<option v-for="audioFile in audioFiles" :value="audioFile">
{{ audioFile }}
</option>
</select>
</div>
<div>
<label id="audio-label">Audio Player</label>
<audio id="audio" controls :src="`sounds/${selectedAudio}`"></audio>
</div>
</div>
<button class="btn-success" @click="run">CLASSIFY</button>
<h3>{{statusMessage}}</h3>
<table v-if="classificationLabels.length > 0">
<thead>
<tr>
<th>Label</th>
<th>Score</th>
</tr>
</thead>
<tbody>
<tr
v-for="classificationLabel in classificationLabels"
:key="classificationLabel.label"
>
<td>{{classificationLabel.label}}</td>
<td>{{Math.floor(classificationLabel.score * 100, 2)}}%</td>
</tr>
</tbody>
</table>
</div>
<script type="module" src="./index.js"></script>
</body>
</html>
|