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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"nbformat": 4,
|
3 |
+
"nbformat_minor": 0,
|
4 |
+
"metadata": {
|
5 |
+
"colab": {
|
6 |
+
"name": "AudioClassificationgradio.ipynb",
|
7 |
+
"provenance": [],
|
8 |
+
"collapsed_sections": []
|
9 |
+
},
|
10 |
+
"kernelspec": {
|
11 |
+
"name": "python3",
|
12 |
+
"display_name": "Python 3"
|
13 |
+
},
|
14 |
+
"language_info": {
|
15 |
+
"name": "python"
|
16 |
+
},
|
17 |
+
"widgets": {
|
18 |
+
"application/vnd.jupyter.widget-state+json": {
|
19 |
+
"8e25e79ba0c34ac2a39504d2bdb23a44": {
|
20 |
+
"model_module": "@jupyter-widgets/controls",
|
21 |
+
"model_name": "HBoxModel",
|
22 |
+
"model_module_version": "1.5.0",
|
23 |
+
"state": {
|
24 |
+
"_dom_classes": [],
|
25 |
+
"_model_module": "@jupyter-widgets/controls",
|
26 |
+
"_model_module_version": "1.5.0",
|
27 |
+
"_model_name": "HBoxModel",
|
28 |
+
"_view_count": null,
|
29 |
+
"_view_module": "@jupyter-widgets/controls",
|
30 |
+
"_view_module_version": "1.5.0",
|
31 |
+
"_view_name": "HBoxView",
|
32 |
+
"box_style": "",
|
33 |
+
"children": [
|
34 |
+
"IPY_MODEL_c326c94972544c0cafd0aec1424d3d66",
|
35 |
+
"IPY_MODEL_a5ded79eb6274a2693d4f6f46dbdaae6",
|
36 |
+
"IPY_MODEL_9165407f88a44866a6372082c5a1bdd1"
|
37 |
+
],
|
38 |
+
"layout": "IPY_MODEL_cd13120cc6f345ff958b3438a51d9caf"
|
39 |
+
}
|
40 |
+
},
|
41 |
+
"c326c94972544c0cafd0aec1424d3d66": {
|
42 |
+
"model_module": "@jupyter-widgets/controls",
|
43 |
+
"model_name": "HTMLModel",
|
44 |
+
"model_module_version": "1.5.0",
|
45 |
+
"state": {
|
46 |
+
"_dom_classes": [],
|
47 |
+
"_model_module": "@jupyter-widgets/controls",
|
48 |
+
"_model_module_version": "1.5.0",
|
49 |
+
"_model_name": "HTMLModel",
|
50 |
+
"_view_count": null,
|
51 |
+
"_view_module": "@jupyter-widgets/controls",
|
52 |
+
"_view_module_version": "1.5.0",
|
53 |
+
"_view_name": "HTMLView",
|
54 |
+
"description": "",
|
55 |
+
"description_tooltip": null,
|
56 |
+
"layout": "IPY_MODEL_358da8bada514630b9078cd49fb2b2dc",
|
57 |
+
"placeholder": "",
|
58 |
+
"style": "IPY_MODEL_53a416f6a7e9499ea6a88e44f2087c0d",
|
59 |
+
"value": "Downloading: 100%"
|
60 |
+
}
|
61 |
+
},
|
62 |
+
"a5ded79eb6274a2693d4f6f46dbdaae6": {
|
63 |
+
"model_module": "@jupyter-widgets/controls",
|
64 |
+
"model_name": "FloatProgressModel",
|
65 |
+
"model_module_version": "1.5.0",
|
66 |
+
"state": {
|
67 |
+
"_dom_classes": [],
|
68 |
+
"_model_module": "@jupyter-widgets/controls",
|
69 |
+
"_model_module_version": "1.5.0",
|
70 |
+
"_model_name": "FloatProgressModel",
|
71 |
+
"_view_count": null,
|
72 |
+
"_view_module": "@jupyter-widgets/controls",
|
73 |
+
"_view_module_version": "1.5.0",
|
74 |
+
"_view_name": "ProgressView",
|
75 |
+
"bar_style": "success",
|
76 |
+
"description": "",
|
77 |
+
"description_tooltip": null,
|
78 |
+
"layout": "IPY_MODEL_74ce31440c4c497cb1ff10748a39c9e0",
|
79 |
+
"max": 103192469,
|
80 |
+
"min": 0,
|
81 |
+
"orientation": "horizontal",
|
82 |
+
"style": "IPY_MODEL_908199f1d2244909bd58c3bc46e6a47f",
|
83 |
+
"value": 103192469
|
84 |
+
}
|
85 |
+
},
|
86 |
+
"9165407f88a44866a6372082c5a1bdd1": {
|
87 |
+
"model_module": "@jupyter-widgets/controls",
|
88 |
+
"model_name": "HTMLModel",
|
89 |
+
"model_module_version": "1.5.0",
|
90 |
+
"state": {
|
91 |
+
"_dom_classes": [],
|
92 |
+
"_model_module": "@jupyter-widgets/controls",
|
93 |
+
"_model_module_version": "1.5.0",
|
94 |
+
"_model_name": "HTMLModel",
|
95 |
+
"_view_count": null,
|
96 |
+
"_view_module": "@jupyter-widgets/controls",
|
97 |
+
"_view_module_version": "1.5.0",
|
98 |
+
"_view_name": "HTMLView",
|
99 |
+
"description": "",
|
100 |
+
"description_tooltip": null,
|
101 |
+
"layout": "IPY_MODEL_3efa06b0aafd4f2ea01ebfc0a7d6abe6",
|
102 |
+
"placeholder": "",
|
103 |
+
"style": "IPY_MODEL_10ed9d0b19814111b80a281ea80f60d9",
|
104 |
+
"value": " 103M/103M [00:02<00:00, 51.8MB/s]"
|
105 |
+
}
|
106 |
+
},
|
107 |
+
"cd13120cc6f345ff958b3438a51d9caf": {
|
108 |
+
"model_module": "@jupyter-widgets/base",
|
109 |
+
"model_name": "LayoutModel",
|
110 |
+
"model_module_version": "1.2.0",
|
111 |
+
"state": {
|
112 |
+
"_model_module": "@jupyter-widgets/base",
|
113 |
+
"_model_module_version": "1.2.0",
|
114 |
+
"_model_name": "LayoutModel",
|
115 |
+
"_view_count": null,
|
116 |
+
"_view_module": "@jupyter-widgets/base",
|
117 |
+
"_view_module_version": "1.2.0",
|
118 |
+
"_view_name": "LayoutView",
|
119 |
+
"align_content": null,
|
120 |
+
"align_items": null,
|
121 |
+
"align_self": null,
|
122 |
+
"border": null,
|
123 |
+
"bottom": null,
|
124 |
+
"display": null,
|
125 |
+
"flex": null,
|
126 |
+
"flex_flow": null,
|
127 |
+
"grid_area": null,
|
128 |
+
"grid_auto_columns": null,
|
129 |
+
"grid_auto_flow": null,
|
130 |
+
"grid_auto_rows": null,
|
131 |
+
"grid_column": null,
|
132 |
+
"grid_gap": null,
|
133 |
+
"grid_row": null,
|
134 |
+
"grid_template_areas": null,
|
135 |
+
"grid_template_columns": null,
|
136 |
+
"grid_template_rows": null,
|
137 |
+
"height": null,
|
138 |
+
"justify_content": null,
|
139 |
+
"justify_items": null,
|
140 |
+
"left": null,
|
141 |
+
"margin": null,
|
142 |
+
"max_height": null,
|
143 |
+
"max_width": null,
|
144 |
+
"min_height": null,
|
145 |
+
"min_width": null,
|
146 |
+
"object_fit": null,
|
147 |
+
"object_position": null,
|
148 |
+
"order": null,
|
149 |
+
"overflow": null,
|
150 |
+
"overflow_x": null,
|
151 |
+
"overflow_y": null,
|
152 |
+
"padding": null,
|
153 |
+
"right": null,
|
154 |
+
"top": null,
|
155 |
+
"visibility": null,
|
156 |
+
"width": null
|
157 |
+
}
|
158 |
+
},
|
159 |
+
"358da8bada514630b9078cd49fb2b2dc": {
|
160 |
+
"model_module": "@jupyter-widgets/base",
|
161 |
+
"model_name": "LayoutModel",
|
162 |
+
"model_module_version": "1.2.0",
|
163 |
+
"state": {
|
164 |
+
"_model_module": "@jupyter-widgets/base",
|
165 |
+
"_model_module_version": "1.2.0",
|
166 |
+
"_model_name": "LayoutModel",
|
167 |
+
"_view_count": null,
|
168 |
+
"_view_module": "@jupyter-widgets/base",
|
169 |
+
"_view_module_version": "1.2.0",
|
170 |
+
"_view_name": "LayoutView",
|
171 |
+
"align_content": null,
|
172 |
+
"align_items": null,
|
173 |
+
"align_self": null,
|
174 |
+
"border": null,
|
175 |
+
"bottom": null,
|
176 |
+
"display": null,
|
177 |
+
"flex": null,
|
178 |
+
"flex_flow": null,
|
179 |
+
"grid_area": null,
|
180 |
+
"grid_auto_columns": null,
|
181 |
+
"grid_auto_flow": null,
|
182 |
+
"grid_auto_rows": null,
|
183 |
+
"grid_column": null,
|
184 |
+
"grid_gap": null,
|
185 |
+
"grid_row": null,
|
186 |
+
"grid_template_areas": null,
|
187 |
+
"grid_template_columns": null,
|
188 |
+
"grid_template_rows": null,
|
189 |
+
"height": null,
|
190 |
+
"justify_content": null,
|
191 |
+
"justify_items": null,
|
192 |
+
"left": null,
|
193 |
+
"margin": null,
|
194 |
+
"max_height": null,
|
195 |
+
"max_width": null,
|
196 |
+
"min_height": null,
|
197 |
+
"min_width": null,
|
198 |
+
"object_fit": null,
|
199 |
+
"object_position": null,
|
200 |
+
"order": null,
|
201 |
+
"overflow": null,
|
202 |
+
"overflow_x": null,
|
203 |
+
"overflow_y": null,
|
204 |
+
"padding": null,
|
205 |
+
"right": null,
|
206 |
+
"top": null,
|
207 |
+
"visibility": null,
|
208 |
+
"width": null
|
209 |
+
}
|
210 |
+
},
|
211 |
+
"53a416f6a7e9499ea6a88e44f2087c0d": {
|
212 |
+
"model_module": "@jupyter-widgets/controls",
|
213 |
+
"model_name": "DescriptionStyleModel",
|
214 |
+
"model_module_version": "1.5.0",
|
215 |
+
"state": {
|
216 |
+
"_model_module": "@jupyter-widgets/controls",
|
217 |
+
"_model_module_version": "1.5.0",
|
218 |
+
"_model_name": "DescriptionStyleModel",
|
219 |
+
"_view_count": null,
|
220 |
+
"_view_module": "@jupyter-widgets/base",
|
221 |
+
"_view_module_version": "1.2.0",
|
222 |
+
"_view_name": "StyleView",
|
223 |
+
"description_width": ""
|
224 |
+
}
|
225 |
+
},
|
226 |
+
"74ce31440c4c497cb1ff10748a39c9e0": {
|
227 |
+
"model_module": "@jupyter-widgets/base",
|
228 |
+
"model_name": "LayoutModel",
|
229 |
+
"model_module_version": "1.2.0",
|
230 |
+
"state": {
|
231 |
+
"_model_module": "@jupyter-widgets/base",
|
232 |
+
"_model_module_version": "1.2.0",
|
233 |
+
"_model_name": "LayoutModel",
|
234 |
+
"_view_count": null,
|
235 |
+
"_view_module": "@jupyter-widgets/base",
|
236 |
+
"_view_module_version": "1.2.0",
|
237 |
+
"_view_name": "LayoutView",
|
238 |
+
"align_content": null,
|
239 |
+
"align_items": null,
|
240 |
+
"align_self": null,
|
241 |
+
"border": null,
|
242 |
+
"bottom": null,
|
243 |
+
"display": null,
|
244 |
+
"flex": null,
|
245 |
+
"flex_flow": null,
|
246 |
+
"grid_area": null,
|
247 |
+
"grid_auto_columns": null,
|
248 |
+
"grid_auto_flow": null,
|
249 |
+
"grid_auto_rows": null,
|
250 |
+
"grid_column": null,
|
251 |
+
"grid_gap": null,
|
252 |
+
"grid_row": null,
|
253 |
+
"grid_template_areas": null,
|
254 |
+
"grid_template_columns": null,
|
255 |
+
"grid_template_rows": null,
|
256 |
+
"height": null,
|
257 |
+
"justify_content": null,
|
258 |
+
"justify_items": null,
|
259 |
+
"left": null,
|
260 |
+
"margin": null,
|
261 |
+
"max_height": null,
|
262 |
+
"max_width": null,
|
263 |
+
"min_height": null,
|
264 |
+
"min_width": null,
|
265 |
+
"object_fit": null,
|
266 |
+
"object_position": null,
|
267 |
+
"order": null,
|
268 |
+
"overflow": null,
|
269 |
+
"overflow_x": null,
|
270 |
+
"overflow_y": null,
|
271 |
+
"padding": null,
|
272 |
+
"right": null,
|
273 |
+
"top": null,
|
274 |
+
"visibility": null,
|
275 |
+
"width": null
|
276 |
+
}
|
277 |
+
},
|
278 |
+
"908199f1d2244909bd58c3bc46e6a47f": {
|
279 |
+
"model_module": "@jupyter-widgets/controls",
|
280 |
+
"model_name": "ProgressStyleModel",
|
281 |
+
"model_module_version": "1.5.0",
|
282 |
+
"state": {
|
283 |
+
"_model_module": "@jupyter-widgets/controls",
|
284 |
+
"_model_module_version": "1.5.0",
|
285 |
+
"_model_name": "ProgressStyleModel",
|
286 |
+
"_view_count": null,
|
287 |
+
"_view_module": "@jupyter-widgets/base",
|
288 |
+
"_view_module_version": "1.2.0",
|
289 |
+
"_view_name": "StyleView",
|
290 |
+
"bar_color": null,
|
291 |
+
"description_width": ""
|
292 |
+
}
|
293 |
+
},
|
294 |
+
"3efa06b0aafd4f2ea01ebfc0a7d6abe6": {
|
295 |
+
"model_module": "@jupyter-widgets/base",
|
296 |
+
"model_name": "LayoutModel",
|
297 |
+
"model_module_version": "1.2.0",
|
298 |
+
"state": {
|
299 |
+
"_model_module": "@jupyter-widgets/base",
|
300 |
+
"_model_module_version": "1.2.0",
|
301 |
+
"_model_name": "LayoutModel",
|
302 |
+
"_view_count": null,
|
303 |
+
"_view_module": "@jupyter-widgets/base",
|
304 |
+
"_view_module_version": "1.2.0",
|
305 |
+
"_view_name": "LayoutView",
|
306 |
+
"align_content": null,
|
307 |
+
"align_items": null,
|
308 |
+
"align_self": null,
|
309 |
+
"border": null,
|
310 |
+
"bottom": null,
|
311 |
+
"display": null,
|
312 |
+
"flex": null,
|
313 |
+
"flex_flow": null,
|
314 |
+
"grid_area": null,
|
315 |
+
"grid_auto_columns": null,
|
316 |
+
"grid_auto_flow": null,
|
317 |
+
"grid_auto_rows": null,
|
318 |
+
"grid_column": null,
|
319 |
+
"grid_gap": null,
|
320 |
+
"grid_row": null,
|
321 |
+
"grid_template_areas": null,
|
322 |
+
"grid_template_columns": null,
|
323 |
+
"grid_template_rows": null,
|
324 |
+
"height": null,
|
325 |
+
"justify_content": null,
|
326 |
+
"justify_items": null,
|
327 |
+
"left": null,
|
328 |
+
"margin": null,
|
329 |
+
"max_height": null,
|
330 |
+
"max_width": null,
|
331 |
+
"min_height": null,
|
332 |
+
"min_width": null,
|
333 |
+
"object_fit": null,
|
334 |
+
"object_position": null,
|
335 |
+
"order": null,
|
336 |
+
"overflow": null,
|
337 |
+
"overflow_x": null,
|
338 |
+
"overflow_y": null,
|
339 |
+
"padding": null,
|
340 |
+
"right": null,
|
341 |
+
"top": null,
|
342 |
+
"visibility": null,
|
343 |
+
"width": null
|
344 |
+
}
|
345 |
+
},
|
346 |
+
"10ed9d0b19814111b80a281ea80f60d9": {
|
347 |
+
"model_module": "@jupyter-widgets/controls",
|
348 |
+
"model_name": "DescriptionStyleModel",
|
349 |
+
"model_module_version": "1.5.0",
|
350 |
+
"state": {
|
351 |
+
"_model_module": "@jupyter-widgets/controls",
|
352 |
+
"_model_module_version": "1.5.0",
|
353 |
+
"_model_name": "DescriptionStyleModel",
|
354 |
+
"_view_count": null,
|
355 |
+
"_view_module": "@jupyter-widgets/base",
|
356 |
+
"_view_module_version": "1.2.0",
|
357 |
+
"_view_name": "StyleView",
|
358 |
+
"description_width": ""
|
359 |
+
}
|
360 |
+
}
|
361 |
+
}
|
362 |
+
}
|
363 |
+
},
|
364 |
+
"cells": [
|
365 |
+
{
|
366 |
+
"cell_type": "code",
|
367 |
+
"execution_count": 1,
|
368 |
+
"metadata": {
|
369 |
+
"colab": {
|
370 |
+
"base_uri": "https://localhost:8080/"
|
371 |
+
},
|
372 |
+
"id": "tj_BVh5omaoQ",
|
373 |
+
"outputId": "413b2cf4-f8da-4bb3-a0a3-1c58cd89cfa0"
|
374 |
+
},
|
375 |
+
"outputs": [
|
376 |
+
{
|
377 |
+
"output_type": "stream",
|
378 |
+
"name": "stdout",
|
379 |
+
"text": [
|
380 |
+
"\u001b[K |████████████████████████████████| 197 kB 24.3 MB/s \n",
|
381 |
+
"\u001b[K |████████████████████████████████| 2.9 MB 52.4 MB/s \n",
|
382 |
+
"\u001b[K |████████████████████████████████| 77 kB 5.4 MB/s \n",
|
383 |
+
"\u001b[K |████████████████████████████████| 60 kB 6.1 MB/s \n",
|
384 |
+
"\u001b[K |████████████████████████████████| 84 kB 3.1 MB/s \n",
|
385 |
+
"\u001b[K |████████████████████████████████| 54 kB 2.7 MB/s \n",
|
386 |
+
"\u001b[K |████████████████████████████████| 1.1 MB 40.9 MB/s \n",
|
387 |
+
"\u001b[K |████████████████████████████████| 2.0 MB 42.1 MB/s \n",
|
388 |
+
"\u001b[K |████████████████████████████████| 253 kB 54.9 MB/s \n",
|
389 |
+
"\u001b[K |████████████████████████████████| 53 kB 2.1 MB/s \n",
|
390 |
+
"\u001b[K |████████████████████████████████| 212 kB 44.2 MB/s \n",
|
391 |
+
"\u001b[K |████████████████████████████████| 271 kB 64.4 MB/s \n",
|
392 |
+
"\u001b[K |████████████████████████████████| 144 kB 45.5 MB/s \n",
|
393 |
+
"\u001b[K |████████████████████████████████| 94 kB 3.1 MB/s \n",
|
394 |
+
"\u001b[K |████████████████████████████████| 58 kB 6.2 MB/s \n",
|
395 |
+
"\u001b[K |████████████████████████████████| 10.9 MB 53.7 MB/s \n",
|
396 |
+
"\u001b[K |████████████████████████████████| 79 kB 7.1 MB/s \n",
|
397 |
+
"\u001b[K |████████████████████████████████| 43 kB 1.8 MB/s \n",
|
398 |
+
"\u001b[K |████████████████████████████████| 62 kB 953 kB/s \n",
|
399 |
+
"\u001b[K |████████████████████████████████| 856 kB 47.5 MB/s \n",
|
400 |
+
"\u001b[K |████████████████████████████████| 4.0 MB 58.7 MB/s \n",
|
401 |
+
"\u001b[K |████████████████████████████████| 58 kB 6.0 MB/s \n",
|
402 |
+
"\u001b[?25h Building wheel for ffmpy (setup.py) ... \u001b[?25l\u001b[?25hdone\n",
|
403 |
+
" Building wheel for python-multipart (setup.py) ... \u001b[?25l\u001b[?25hdone\n"
|
404 |
+
]
|
405 |
+
}
|
406 |
+
],
|
407 |
+
"source": [
|
408 |
+
"! pip install -Uqq fastai gradio torchaudio torchvision huggingface_hub"
|
409 |
+
]
|
410 |
+
},
|
411 |
+
{
|
412 |
+
"cell_type": "code",
|
413 |
+
"source": [
|
414 |
+
"import gradio\n",
|
415 |
+
"import torchaudio\n",
|
416 |
+
"from fastai.vision.all import *\n",
|
417 |
+
"from fastai.learner import load_learner\n",
|
418 |
+
"from torchvision.utils import save_image\n",
|
419 |
+
"from huggingface_hub import hf_hub_download"
|
420 |
+
],
|
421 |
+
"metadata": {
|
422 |
+
"colab": {
|
423 |
+
"base_uri": "https://localhost:8080/"
|
424 |
+
},
|
425 |
+
"id": "xIM_o4w-ms2J",
|
426 |
+
"outputId": "936b730f-2d52-4cc2-fd7a-afbf86d05687"
|
427 |
+
},
|
428 |
+
"execution_count": 2,
|
429 |
+
"outputs": [
|
430 |
+
{
|
431 |
+
"output_type": "stream",
|
432 |
+
"name": "stderr",
|
433 |
+
"text": [
|
434 |
+
"/usr/local/lib/python3.7/dist-packages/paramiko/transport.py:236: CryptographyDeprecationWarning: Blowfish has been deprecated\n",
|
435 |
+
" \"class\": algorithms.Blowfish,\n"
|
436 |
+
]
|
437 |
+
}
|
438 |
+
]
|
439 |
+
},
|
440 |
+
{
|
441 |
+
"cell_type": "code",
|
442 |
+
"source": [
|
443 |
+
"model = load_learner(\n",
|
444 |
+
" hf_hub_download(\"kurianbenoy/music_genre_classification_baseline\", \"model.pkl\")\n",
|
445 |
+
")\n",
|
446 |
+
"\n",
|
447 |
+
"labels = model.dls.vocab"
|
448 |
+
],
|
449 |
+
"metadata": {
|
450 |
+
"colab": {
|
451 |
+
"base_uri": "https://localhost:8080/",
|
452 |
+
"height": 49,
|
453 |
+
"referenced_widgets": [
|
454 |
+
"8e25e79ba0c34ac2a39504d2bdb23a44",
|
455 |
+
"c326c94972544c0cafd0aec1424d3d66",
|
456 |
+
"a5ded79eb6274a2693d4f6f46dbdaae6",
|
457 |
+
"9165407f88a44866a6372082c5a1bdd1",
|
458 |
+
"cd13120cc6f345ff958b3438a51d9caf",
|
459 |
+
"358da8bada514630b9078cd49fb2b2dc",
|
460 |
+
"53a416f6a7e9499ea6a88e44f2087c0d",
|
461 |
+
"74ce31440c4c497cb1ff10748a39c9e0",
|
462 |
+
"908199f1d2244909bd58c3bc46e6a47f",
|
463 |
+
"3efa06b0aafd4f2ea01ebfc0a7d6abe6",
|
464 |
+
"10ed9d0b19814111b80a281ea80f60d9"
|
465 |
+
]
|
466 |
+
},
|
467 |
+
"id": "MJxNnlsYmwsJ",
|
468 |
+
"outputId": "3ba1eca7-1986-4f29-a549-b51bb79a4c88"
|
469 |
+
},
|
470 |
+
"execution_count": 3,
|
471 |
+
"outputs": [
|
472 |
+
{
|
473 |
+
"output_type": "display_data",
|
474 |
+
"data": {
|
475 |
+
"text/plain": [
|
476 |
+
"Downloading: 0%| | 0.00/103M [00:00<?, ?B/s]"
|
477 |
+
],
|
478 |
+
"application/vnd.jupyter.widget-view+json": {
|
479 |
+
"version_major": 2,
|
480 |
+
"version_minor": 0,
|
481 |
+
"model_id": "8e25e79ba0c34ac2a39504d2bdb23a44"
|
482 |
+
}
|
483 |
+
},
|
484 |
+
"metadata": {}
|
485 |
+
}
|
486 |
+
]
|
487 |
+
},
|
488 |
+
{
|
489 |
+
"cell_type": "code",
|
490 |
+
"source": [
|
491 |
+
"N_FFT = 2048\n",
|
492 |
+
"HOP_LEN = 1024\n",
|
493 |
+
"\n",
|
494 |
+
"\n",
|
495 |
+
"def create_spectrogram(filename):\n",
|
496 |
+
" audio, sr = torchaudio.load(filename)\n",
|
497 |
+
" specgram = torchaudio.transforms.MelSpectrogram(\n",
|
498 |
+
" sample_rate=sr,\n",
|
499 |
+
" n_fft=N_FFT,\n",
|
500 |
+
" win_length=N_FFT,\n",
|
501 |
+
" hop_length=HOP_LEN,\n",
|
502 |
+
" center=True,\n",
|
503 |
+
" pad_mode=\"reflect\",\n",
|
504 |
+
" power=2.0,\n",
|
505 |
+
" norm=\"slaney\",\n",
|
506 |
+
" onesided=True,\n",
|
507 |
+
" n_mels=224,\n",
|
508 |
+
" mel_scale=\"htk\",\n",
|
509 |
+
" )(audio).mean(axis=0)\n",
|
510 |
+
" specgram = torchaudio.transforms.AmplitudeToDB()(specgram)\n",
|
511 |
+
" specgram = specgram - specgram.min()\n",
|
512 |
+
" specgram = specgram / specgram.max()\n",
|
513 |
+
"\n",
|
514 |
+
" return specgram"
|
515 |
+
],
|
516 |
+
"metadata": {
|
517 |
+
"id": "J1Goh5DHnm59"
|
518 |
+
},
|
519 |
+
"execution_count": 8,
|
520 |
+
"outputs": []
|
521 |
+
},
|
522 |
+
{
|
523 |
+
"cell_type": "code",
|
524 |
+
"source": [
|
525 |
+
"def create_image(filename):\n",
|
526 |
+
" specgram = create_spectrogram(filename)\n",
|
527 |
+
" dest = Path(\"temp.png\")\n",
|
528 |
+
" save_image(specgram, \"temp.png\")"
|
529 |
+
],
|
530 |
+
"metadata": {
|
531 |
+
"id": "-J15K2MmqADm"
|
532 |
+
},
|
533 |
+
"execution_count": 11,
|
534 |
+
"outputs": []
|
535 |
+
},
|
536 |
+
{
|
537 |
+
"cell_type": "code",
|
538 |
+
"source": [
|
539 |
+
"def predict(img):\n",
|
540 |
+
" img = PILImage.create(img)\n",
|
541 |
+
" _pred, _pred_w_idx, probs = model.predict(img)\n",
|
542 |
+
" labels_probs = {labels[i]: float(probs[i]) for i, _ in enumerate(labels)}\n",
|
543 |
+
" return labels_probs"
|
544 |
+
],
|
545 |
+
"metadata": {
|
546 |
+
"id": "1cOhBdp0m2Q5"
|
547 |
+
},
|
548 |
+
"execution_count": 4,
|
549 |
+
"outputs": []
|
550 |
+
},
|
551 |
+
{
|
552 |
+
"cell_type": "code",
|
553 |
+
"source": [
|
554 |
+
"def end2endpipeline(filename):\n",
|
555 |
+
" create_image(filename)\n",
|
556 |
+
" return predict(\"temp.png\")"
|
557 |
+
],
|
558 |
+
"metadata": {
|
559 |
+
"id": "eXIEc4blqOWQ"
|
560 |
+
},
|
561 |
+
"execution_count": 12,
|
562 |
+
"outputs": []
|
563 |
+
},
|
564 |
+
{
|
565 |
+
"cell_type": "code",
|
566 |
+
"source": [
|
567 |
+
"interface_options = {\n",
|
568 |
+
" \"title\": \"Music Genre Classification\",\n",
|
569 |
+
" \"description\": \"A simple baseline model for classifying music genres with fast.ai on [Kaggle competition data](https://www.kaggle.com/competitions/kaggle-pog-series-s01e02/data)\",\n",
|
570 |
+
" \"interpretation\": \"default\",\n",
|
571 |
+
" \"layout\": \"horizontal\",\n",
|
572 |
+
" \"theme\": \"default\",\n",
|
573 |
+
"}\n",
|
574 |
+
"\n",
|
575 |
+
"demo = gradio.Interface(\n",
|
576 |
+
" fn=end2endpipeline,\n",
|
577 |
+
" inputs=gradio.inputs.Audio(source=\"microphone\", type=\"filepath\", label=\"Record/ Drop audio\"),\n",
|
578 |
+
" outputs=gradio.outputs.Label(num_top_classes=5),\n",
|
579 |
+
" **interface_options,\n",
|
580 |
+
")\n",
|
581 |
+
"\n",
|
582 |
+
"launch_options = {\n",
|
583 |
+
" \"enable_queue\": True,\n",
|
584 |
+
" \"share\": False,\n",
|
585 |
+
"}\n",
|
586 |
+
"demo.launch(**launch_options)"
|
587 |
+
],
|
588 |
+
"metadata": {
|
589 |
+
"colab": {
|
590 |
+
"base_uri": "https://localhost:8080/",
|
591 |
+
"height": 662
|
592 |
+
},
|
593 |
+
"id": "uMO5CynZm_pL",
|
594 |
+
"outputId": "0cff073a-293d-4c3d-d3bf-a924d63cdfec"
|
595 |
+
},
|
596 |
+
"execution_count": 13,
|
597 |
+
"outputs": [
|
598 |
+
{
|
599 |
+
"output_type": "stream",
|
600 |
+
"name": "stdout",
|
601 |
+
"text": [
|
602 |
+
"Colab notebook detected. To show errors in colab notebook, set `debug=True` in `launch()`\n",
|
603 |
+
"Your interface requires microphone or webcam permissions - this may cause issues in Colab. Use the External URL in case of issues.\n",
|
604 |
+
"Running on public URL: https://55955.gradio.app\n",
|
605 |
+
"\n",
|
606 |
+
"This share link expires in 72 hours. For free permanent hosting, check out Spaces (https://huggingface.co/spaces)\n"
|
607 |
+
]
|
608 |
+
},
|
609 |
+
{
|
610 |
+
"output_type": "display_data",
|
611 |
+
"data": {
|
612 |
+
"text/plain": [
|
613 |
+
"<IPython.lib.display.IFrame at 0x7f647af3b450>"
|
614 |
+
],
|
615 |
+
"text/html": [
|
616 |
+
"\n",
|
617 |
+
" <iframe\n",
|
618 |
+
" width=\"900\"\n",
|
619 |
+
" height=\"500\"\n",
|
620 |
+
" src=\"https://55955.gradio.app\"\n",
|
621 |
+
" frameborder=\"0\"\n",
|
622 |
+
" allowfullscreen\n",
|
623 |
+
" ></iframe>\n",
|
624 |
+
" "
|
625 |
+
]
|
626 |
+
},
|
627 |
+
"metadata": {}
|
628 |
+
},
|
629 |
+
{
|
630 |
+
"output_type": "execute_result",
|
631 |
+
"data": {
|
632 |
+
"text/plain": [
|
633 |
+
"(<fastapi.applications.FastAPI at 0x7f65bf011ed0>,\n",
|
634 |
+
" 'http://127.0.0.1:7862/',\n",
|
635 |
+
" 'https://55955.gradio.app')"
|
636 |
+
]
|
637 |
+
},
|
638 |
+
"metadata": {},
|
639 |
+
"execution_count": 13
|
640 |
+
}
|
641 |
+
]
|
642 |
+
},
|
643 |
+
{
|
644 |
+
"cell_type": "code",
|
645 |
+
"source": [
|
646 |
+
"input_audio = [gradio.inputs.Audio(source=\"microphone\", type=\"filepath\", label=\"Record/ Drop audio\")]\n",
|
647 |
+
"input_audio"
|
648 |
+
],
|
649 |
+
"metadata": {
|
650 |
+
"colab": {
|
651 |
+
"base_uri": "https://localhost:8080/"
|
652 |
+
},
|
653 |
+
"id": "8Ptz2HMdnAE7",
|
654 |
+
"outputId": "2cac3314-07eb-4c91-d5ed-770e2ed6ae0d"
|
655 |
+
},
|
656 |
+
"execution_count": 9,
|
657 |
+
"outputs": [
|
658 |
+
{
|
659 |
+
"output_type": "execute_result",
|
660 |
+
"data": {
|
661 |
+
"text/plain": [
|
662 |
+
"[Audio(label=\"Record/ Drop audio\")]"
|
663 |
+
]
|
664 |
+
},
|
665 |
+
"metadata": {},
|
666 |
+
"execution_count": 9
|
667 |
+
}
|
668 |
+
]
|
669 |
+
},
|
670 |
+
{
|
671 |
+
"cell_type": "code",
|
672 |
+
"source": [
|
673 |
+
""
|
674 |
+
],
|
675 |
+
"metadata": {
|
676 |
+
"id": "_wHGGfNfnufy"
|
677 |
+
},
|
678 |
+
"execution_count": null,
|
679 |
+
"outputs": []
|
680 |
+
}
|
681 |
+
]
|
682 |
+
}
|