Files changed (5) hide show
  1. Accent.ipynb +0 -2038
  2. accent.py +0 -180
  3. app.py +0 -65
  4. packages.txt +0 -2
  5. requirements.txt +0 -7
Accent.ipynb DELETED
@@ -1,2038 +0,0 @@
1
- {
2
- "nbformat": 4,
3
- "nbformat_minor": 0,
4
- "metadata": {
5
- "colab": {
6
- "provenance": [],
7
- "gpuType": "T4"
8
- },
9
- "kernelspec": {
10
- "name": "python3",
11
- "display_name": "Python 3"
12
- },
13
- "language_info": {
14
- "name": "python"
15
- },
16
- "accelerator": "GPU",
17
- "widgets": {
18
- "application/vnd.jupyter.widget-state+json": {
19
- "025b845ba49e423cbfc757252db02381": {
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_e29ef8d387a94e6990343111c600d40f",
35
- "IPY_MODEL_bd085d627a404aac90bb6336f74d22a9",
36
- "IPY_MODEL_06c62bd2fcc346a197c3579d00ca0d44"
37
- ],
38
- "layout": "IPY_MODEL_df3990918f424c60be35b4c5be90ac34"
39
- }
40
- },
41
- "e29ef8d387a94e6990343111c600d40f": {
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_3c88eea7ce64430e94e998a81463143e",
57
- "placeholder": "​",
58
- "style": "IPY_MODEL_0f38dc6f89064ec49950502e32a5cc53",
59
- "value": "hyperparams.yaml: 100%"
60
- }
61
- },
62
- "bd085d627a404aac90bb6336f74d22a9": {
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_f6d0a0357ac048d9ad5ef31056fb65a1",
79
- "max": 1666,
80
- "min": 0,
81
- "orientation": "horizontal",
82
- "style": "IPY_MODEL_a570c3b7f01a4906a51eff36d264bb26",
83
- "value": 1666
84
- }
85
- },
86
- "06c62bd2fcc346a197c3579d00ca0d44": {
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_4e352cff53fa49069d0131578fd3248d",
102
- "placeholder": "​",
103
- "style": "IPY_MODEL_2ca94275b52b488fa7755de3c7b03216",
104
- "value": " 1.67k/1.67k [00:00<00:00, 169kB/s]"
105
- }
106
- },
107
- "df3990918f424c60be35b4c5be90ac34": {
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
- "3c88eea7ce64430e94e998a81463143e": {
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
- "0f38dc6f89064ec49950502e32a5cc53": {
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
- "f6d0a0357ac048d9ad5ef31056fb65a1": {
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
- "a570c3b7f01a4906a51eff36d264bb26": {
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
- "4e352cff53fa49069d0131578fd3248d": {
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
- "2ca94275b52b488fa7755de3c7b03216": {
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
- "d7a05ee4c7c24eacbddf57ab6644639b": {
362
- "model_module": "@jupyter-widgets/controls",
363
- "model_name": "HBoxModel",
364
- "model_module_version": "1.5.0",
365
- "state": {
366
- "_dom_classes": [],
367
- "_model_module": "@jupyter-widgets/controls",
368
- "_model_module_version": "1.5.0",
369
- "_model_name": "HBoxModel",
370
- "_view_count": null,
371
- "_view_module": "@jupyter-widgets/controls",
372
- "_view_module_version": "1.5.0",
373
- "_view_name": "HBoxView",
374
- "box_style": "",
375
- "children": [
376
- "IPY_MODEL_9e2406e1e42d42068d99c706484bab9a",
377
- "IPY_MODEL_2d49939f1d264b59906278bf4939ab2a",
378
- "IPY_MODEL_87a3a050b04e4e5b941951780926d36c"
379
- ],
380
- "layout": "IPY_MODEL_f0d5a89ad850448abcd506d6de86fff9"
381
- }
382
- },
383
- "9e2406e1e42d42068d99c706484bab9a": {
384
- "model_module": "@jupyter-widgets/controls",
385
- "model_name": "HTMLModel",
386
- "model_module_version": "1.5.0",
387
- "state": {
388
- "_dom_classes": [],
389
- "_model_module": "@jupyter-widgets/controls",
390
- "_model_module_version": "1.5.0",
391
- "_model_name": "HTMLModel",
392
- "_view_count": null,
393
- "_view_module": "@jupyter-widgets/controls",
394
- "_view_module_version": "1.5.0",
395
- "_view_name": "HTMLView",
396
- "description": "",
397
- "description_tooltip": null,
398
- "layout": "IPY_MODEL_16ccf523e9c24390ba654e282241831d",
399
- "placeholder": "​",
400
- "style": "IPY_MODEL_25da015c20f8426db38b3853245b37a4",
401
- "value": "embedding_model.ckpt: 100%"
402
- }
403
- },
404
- "2d49939f1d264b59906278bf4939ab2a": {
405
- "model_module": "@jupyter-widgets/controls",
406
- "model_name": "FloatProgressModel",
407
- "model_module_version": "1.5.0",
408
- "state": {
409
- "_dom_classes": [],
410
- "_model_module": "@jupyter-widgets/controls",
411
- "_model_module_version": "1.5.0",
412
- "_model_name": "FloatProgressModel",
413
- "_view_count": null,
414
- "_view_module": "@jupyter-widgets/controls",
415
- "_view_module_version": "1.5.0",
416
- "_view_name": "ProgressView",
417
- "bar_style": "success",
418
- "description": "",
419
- "description_tooltip": null,
420
- "layout": "IPY_MODEL_77c6272fc49448529d7a7a919b1cc418",
421
- "max": 83310835,
422
- "min": 0,
423
- "orientation": "horizontal",
424
- "style": "IPY_MODEL_a9c2643b4c3f4af7b54b9c3940377519",
425
- "value": 83310835
426
- }
427
- },
428
- "87a3a050b04e4e5b941951780926d36c": {
429
- "model_module": "@jupyter-widgets/controls",
430
- "model_name": "HTMLModel",
431
- "model_module_version": "1.5.0",
432
- "state": {
433
- "_dom_classes": [],
434
- "_model_module": "@jupyter-widgets/controls",
435
- "_model_module_version": "1.5.0",
436
- "_model_name": "HTMLModel",
437
- "_view_count": null,
438
- "_view_module": "@jupyter-widgets/controls",
439
- "_view_module_version": "1.5.0",
440
- "_view_name": "HTMLView",
441
- "description": "",
442
- "description_tooltip": null,
443
- "layout": "IPY_MODEL_75b859dc0f5642408cf318d6583a8da3",
444
- "placeholder": "​",
445
- "style": "IPY_MODEL_424c140f22c142988c5e95114c4680d7",
446
- "value": " 83.3M/83.3M [00:00<00:00, 156MB/s]"
447
- }
448
- },
449
- "f0d5a89ad850448abcd506d6de86fff9": {
450
- "model_module": "@jupyter-widgets/base",
451
- "model_name": "LayoutModel",
452
- "model_module_version": "1.2.0",
453
- "state": {
454
- "_model_module": "@jupyter-widgets/base",
455
- "_model_module_version": "1.2.0",
456
- "_model_name": "LayoutModel",
457
- "_view_count": null,
458
- "_view_module": "@jupyter-widgets/base",
459
- "_view_module_version": "1.2.0",
460
- "_view_name": "LayoutView",
461
- "align_content": null,
462
- "align_items": null,
463
- "align_self": null,
464
- "border": null,
465
- "bottom": null,
466
- "display": null,
467
- "flex": null,
468
- "flex_flow": null,
469
- "grid_area": null,
470
- "grid_auto_columns": null,
471
- "grid_auto_flow": null,
472
- "grid_auto_rows": null,
473
- "grid_column": null,
474
- "grid_gap": null,
475
- "grid_row": null,
476
- "grid_template_areas": null,
477
- "grid_template_columns": null,
478
- "grid_template_rows": null,
479
- "height": null,
480
- "justify_content": null,
481
- "justify_items": null,
482
- "left": null,
483
- "margin": null,
484
- "max_height": null,
485
- "max_width": null,
486
- "min_height": null,
487
- "min_width": null,
488
- "object_fit": null,
489
- "object_position": null,
490
- "order": null,
491
- "overflow": null,
492
- "overflow_x": null,
493
- "overflow_y": null,
494
- "padding": null,
495
- "right": null,
496
- "top": null,
497
- "visibility": null,
498
- "width": null
499
- }
500
- },
501
- "16ccf523e9c24390ba654e282241831d": {
502
- "model_module": "@jupyter-widgets/base",
503
- "model_name": "LayoutModel",
504
- "model_module_version": "1.2.0",
505
- "state": {
506
- "_model_module": "@jupyter-widgets/base",
507
- "_model_module_version": "1.2.0",
508
- "_model_name": "LayoutModel",
509
- "_view_count": null,
510
- "_view_module": "@jupyter-widgets/base",
511
- "_view_module_version": "1.2.0",
512
- "_view_name": "LayoutView",
513
- "align_content": null,
514
- "align_items": null,
515
- "align_self": null,
516
- "border": null,
517
- "bottom": null,
518
- "display": null,
519
- "flex": null,
520
- "flex_flow": null,
521
- "grid_area": null,
522
- "grid_auto_columns": null,
523
- "grid_auto_flow": null,
524
- "grid_auto_rows": null,
525
- "grid_column": null,
526
- "grid_gap": null,
527
- "grid_row": null,
528
- "grid_template_areas": null,
529
- "grid_template_columns": null,
530
- "grid_template_rows": null,
531
- "height": null,
532
- "justify_content": null,
533
- "justify_items": null,
534
- "left": null,
535
- "margin": null,
536
- "max_height": null,
537
- "max_width": null,
538
- "min_height": null,
539
- "min_width": null,
540
- "object_fit": null,
541
- "object_position": null,
542
- "order": null,
543
- "overflow": null,
544
- "overflow_x": null,
545
- "overflow_y": null,
546
- "padding": null,
547
- "right": null,
548
- "top": null,
549
- "visibility": null,
550
- "width": null
551
- }
552
- },
553
- "25da015c20f8426db38b3853245b37a4": {
554
- "model_module": "@jupyter-widgets/controls",
555
- "model_name": "DescriptionStyleModel",
556
- "model_module_version": "1.5.0",
557
- "state": {
558
- "_model_module": "@jupyter-widgets/controls",
559
- "_model_module_version": "1.5.0",
560
- "_model_name": "DescriptionStyleModel",
561
- "_view_count": null,
562
- "_view_module": "@jupyter-widgets/base",
563
- "_view_module_version": "1.2.0",
564
- "_view_name": "StyleView",
565
- "description_width": ""
566
- }
567
- },
568
- "77c6272fc49448529d7a7a919b1cc418": {
569
- "model_module": "@jupyter-widgets/base",
570
- "model_name": "LayoutModel",
571
- "model_module_version": "1.2.0",
572
- "state": {
573
- "_model_module": "@jupyter-widgets/base",
574
- "_model_module_version": "1.2.0",
575
- "_model_name": "LayoutModel",
576
- "_view_count": null,
577
- "_view_module": "@jupyter-widgets/base",
578
- "_view_module_version": "1.2.0",
579
- "_view_name": "LayoutView",
580
- "align_content": null,
581
- "align_items": null,
582
- "align_self": null,
583
- "border": null,
584
- "bottom": null,
585
- "display": null,
586
- "flex": null,
587
- "flex_flow": null,
588
- "grid_area": null,
589
- "grid_auto_columns": null,
590
- "grid_auto_flow": null,
591
- "grid_auto_rows": null,
592
- "grid_column": null,
593
- "grid_gap": null,
594
- "grid_row": null,
595
- "grid_template_areas": null,
596
- "grid_template_columns": null,
597
- "grid_template_rows": null,
598
- "height": null,
599
- "justify_content": null,
600
- "justify_items": null,
601
- "left": null,
602
- "margin": null,
603
- "max_height": null,
604
- "max_width": null,
605
- "min_height": null,
606
- "min_width": null,
607
- "object_fit": null,
608
- "object_position": null,
609
- "order": null,
610
- "overflow": null,
611
- "overflow_x": null,
612
- "overflow_y": null,
613
- "padding": null,
614
- "right": null,
615
- "top": null,
616
- "visibility": null,
617
- "width": null
618
- }
619
- },
620
- "a9c2643b4c3f4af7b54b9c3940377519": {
621
- "model_module": "@jupyter-widgets/controls",
622
- "model_name": "ProgressStyleModel",
623
- "model_module_version": "1.5.0",
624
- "state": {
625
- "_model_module": "@jupyter-widgets/controls",
626
- "_model_module_version": "1.5.0",
627
- "_model_name": "ProgressStyleModel",
628
- "_view_count": null,
629
- "_view_module": "@jupyter-widgets/base",
630
- "_view_module_version": "1.2.0",
631
- "_view_name": "StyleView",
632
- "bar_color": null,
633
- "description_width": ""
634
- }
635
- },
636
- "75b859dc0f5642408cf318d6583a8da3": {
637
- "model_module": "@jupyter-widgets/base",
638
- "model_name": "LayoutModel",
639
- "model_module_version": "1.2.0",
640
- "state": {
641
- "_model_module": "@jupyter-widgets/base",
642
- "_model_module_version": "1.2.0",
643
- "_model_name": "LayoutModel",
644
- "_view_count": null,
645
- "_view_module": "@jupyter-widgets/base",
646
- "_view_module_version": "1.2.0",
647
- "_view_name": "LayoutView",
648
- "align_content": null,
649
- "align_items": null,
650
- "align_self": null,
651
- "border": null,
652
- "bottom": null,
653
- "display": null,
654
- "flex": null,
655
- "flex_flow": null,
656
- "grid_area": null,
657
- "grid_auto_columns": null,
658
- "grid_auto_flow": null,
659
- "grid_auto_rows": null,
660
- "grid_column": null,
661
- "grid_gap": null,
662
- "grid_row": null,
663
- "grid_template_areas": null,
664
- "grid_template_columns": null,
665
- "grid_template_rows": null,
666
- "height": null,
667
- "justify_content": null,
668
- "justify_items": null,
669
- "left": null,
670
- "margin": null,
671
- "max_height": null,
672
- "max_width": null,
673
- "min_height": null,
674
- "min_width": null,
675
- "object_fit": null,
676
- "object_position": null,
677
- "order": null,
678
- "overflow": null,
679
- "overflow_x": null,
680
- "overflow_y": null,
681
- "padding": null,
682
- "right": null,
683
- "top": null,
684
- "visibility": null,
685
- "width": null
686
- }
687
- },
688
- "424c140f22c142988c5e95114c4680d7": {
689
- "model_module": "@jupyter-widgets/controls",
690
- "model_name": "DescriptionStyleModel",
691
- "model_module_version": "1.5.0",
692
- "state": {
693
- "_model_module": "@jupyter-widgets/controls",
694
- "_model_module_version": "1.5.0",
695
- "_model_name": "DescriptionStyleModel",
696
- "_view_count": null,
697
- "_view_module": "@jupyter-widgets/base",
698
- "_view_module_version": "1.2.0",
699
- "_view_name": "StyleView",
700
- "description_width": ""
701
- }
702
- },
703
- "a0ae653cdf364d528ff132a48c1020c4": {
704
- "model_module": "@jupyter-widgets/controls",
705
- "model_name": "HBoxModel",
706
- "model_module_version": "1.5.0",
707
- "state": {
708
- "_dom_classes": [],
709
- "_model_module": "@jupyter-widgets/controls",
710
- "_model_module_version": "1.5.0",
711
- "_model_name": "HBoxModel",
712
- "_view_count": null,
713
- "_view_module": "@jupyter-widgets/controls",
714
- "_view_module_version": "1.5.0",
715
- "_view_name": "HBoxView",
716
- "box_style": "",
717
- "children": [
718
- "IPY_MODEL_353f33d613d34b13944aaca5017752e1",
719
- "IPY_MODEL_bb24cf37e9d948bb81527968af1194c9",
720
- "IPY_MODEL_c2e2a5f07c594707a215a3f3c5e673b9"
721
- ],
722
- "layout": "IPY_MODEL_ae843746277c43e5bbe68390ad8ea887"
723
- }
724
- },
725
- "353f33d613d34b13944aaca5017752e1": {
726
- "model_module": "@jupyter-widgets/controls",
727
- "model_name": "HTMLModel",
728
- "model_module_version": "1.5.0",
729
- "state": {
730
- "_dom_classes": [],
731
- "_model_module": "@jupyter-widgets/controls",
732
- "_model_module_version": "1.5.0",
733
- "_model_name": "HTMLModel",
734
- "_view_count": null,
735
- "_view_module": "@jupyter-widgets/controls",
736
- "_view_module_version": "1.5.0",
737
- "_view_name": "HTMLView",
738
- "description": "",
739
- "description_tooltip": null,
740
- "layout": "IPY_MODEL_901c650e39ea4ddc8148e80f087b40e5",
741
- "placeholder": "​",
742
- "style": "IPY_MODEL_71ffe21e8fe04be3ab6bfb4c10ae2403",
743
- "value": "classifier.ckpt: 100%"
744
- }
745
- },
746
- "bb24cf37e9d948bb81527968af1194c9": {
747
- "model_module": "@jupyter-widgets/controls",
748
- "model_name": "FloatProgressModel",
749
- "model_module_version": "1.5.0",
750
- "state": {
751
- "_dom_classes": [],
752
- "_model_module": "@jupyter-widgets/controls",
753
- "_model_module_version": "1.5.0",
754
- "_model_name": "FloatProgressModel",
755
- "_view_count": null,
756
- "_view_module": "@jupyter-widgets/controls",
757
- "_view_module_version": "1.5.0",
758
- "_view_name": "ProgressView",
759
- "bar_style": "success",
760
- "description": "",
761
- "description_tooltip": null,
762
- "layout": "IPY_MODEL_a749c4a8500c45c4b083918cac225bc0",
763
- "max": 35371,
764
- "min": 0,
765
- "orientation": "horizontal",
766
- "style": "IPY_MODEL_9182ff55244542aa9f77a7fefa181f49",
767
- "value": 35371
768
- }
769
- },
770
- "c2e2a5f07c594707a215a3f3c5e673b9": {
771
- "model_module": "@jupyter-widgets/controls",
772
- "model_name": "HTMLModel",
773
- "model_module_version": "1.5.0",
774
- "state": {
775
- "_dom_classes": [],
776
- "_model_module": "@jupyter-widgets/controls",
777
- "_model_module_version": "1.5.0",
778
- "_model_name": "HTMLModel",
779
- "_view_count": null,
780
- "_view_module": "@jupyter-widgets/controls",
781
- "_view_module_version": "1.5.0",
782
- "_view_name": "HTMLView",
783
- "description": "",
784
- "description_tooltip": null,
785
- "layout": "IPY_MODEL_a9c504808b7c4b87919dfc976342fe0e",
786
- "placeholder": "​",
787
- "style": "IPY_MODEL_7f6e9e7d12574620a04e3ce7040f40d6",
788
- "value": " 35.4k/35.4k [00:00<00:00, 2.55MB/s]"
789
- }
790
- },
791
- "ae843746277c43e5bbe68390ad8ea887": {
792
- "model_module": "@jupyter-widgets/base",
793
- "model_name": "LayoutModel",
794
- "model_module_version": "1.2.0",
795
- "state": {
796
- "_model_module": "@jupyter-widgets/base",
797
- "_model_module_version": "1.2.0",
798
- "_model_name": "LayoutModel",
799
- "_view_count": null,
800
- "_view_module": "@jupyter-widgets/base",
801
- "_view_module_version": "1.2.0",
802
- "_view_name": "LayoutView",
803
- "align_content": null,
804
- "align_items": null,
805
- "align_self": null,
806
- "border": null,
807
- "bottom": null,
808
- "display": null,
809
- "flex": null,
810
- "flex_flow": null,
811
- "grid_area": null,
812
- "grid_auto_columns": null,
813
- "grid_auto_flow": null,
814
- "grid_auto_rows": null,
815
- "grid_column": null,
816
- "grid_gap": null,
817
- "grid_row": null,
818
- "grid_template_areas": null,
819
- "grid_template_columns": null,
820
- "grid_template_rows": null,
821
- "height": null,
822
- "justify_content": null,
823
- "justify_items": null,
824
- "left": null,
825
- "margin": null,
826
- "max_height": null,
827
- "max_width": null,
828
- "min_height": null,
829
- "min_width": null,
830
- "object_fit": null,
831
- "object_position": null,
832
- "order": null,
833
- "overflow": null,
834
- "overflow_x": null,
835
- "overflow_y": null,
836
- "padding": null,
837
- "right": null,
838
- "top": null,
839
- "visibility": null,
840
- "width": null
841
- }
842
- },
843
- "901c650e39ea4ddc8148e80f087b40e5": {
844
- "model_module": "@jupyter-widgets/base",
845
- "model_name": "LayoutModel",
846
- "model_module_version": "1.2.0",
847
- "state": {
848
- "_model_module": "@jupyter-widgets/base",
849
- "_model_module_version": "1.2.0",
850
- "_model_name": "LayoutModel",
851
- "_view_count": null,
852
- "_view_module": "@jupyter-widgets/base",
853
- "_view_module_version": "1.2.0",
854
- "_view_name": "LayoutView",
855
- "align_content": null,
856
- "align_items": null,
857
- "align_self": null,
858
- "border": null,
859
- "bottom": null,
860
- "display": null,
861
- "flex": null,
862
- "flex_flow": null,
863
- "grid_area": null,
864
- "grid_auto_columns": null,
865
- "grid_auto_flow": null,
866
- "grid_auto_rows": null,
867
- "grid_column": null,
868
- "grid_gap": null,
869
- "grid_row": null,
870
- "grid_template_areas": null,
871
- "grid_template_columns": null,
872
- "grid_template_rows": null,
873
- "height": null,
874
- "justify_content": null,
875
- "justify_items": null,
876
- "left": null,
877
- "margin": null,
878
- "max_height": null,
879
- "max_width": null,
880
- "min_height": null,
881
- "min_width": null,
882
- "object_fit": null,
883
- "object_position": null,
884
- "order": null,
885
- "overflow": null,
886
- "overflow_x": null,
887
- "overflow_y": null,
888
- "padding": null,
889
- "right": null,
890
- "top": null,
891
- "visibility": null,
892
- "width": null
893
- }
894
- },
895
- "71ffe21e8fe04be3ab6bfb4c10ae2403": {
896
- "model_module": "@jupyter-widgets/controls",
897
- "model_name": "DescriptionStyleModel",
898
- "model_module_version": "1.5.0",
899
- "state": {
900
- "_model_module": "@jupyter-widgets/controls",
901
- "_model_module_version": "1.5.0",
902
- "_model_name": "DescriptionStyleModel",
903
- "_view_count": null,
904
- "_view_module": "@jupyter-widgets/base",
905
- "_view_module_version": "1.2.0",
906
- "_view_name": "StyleView",
907
- "description_width": ""
908
- }
909
- },
910
- "a749c4a8500c45c4b083918cac225bc0": {
911
- "model_module": "@jupyter-widgets/base",
912
- "model_name": "LayoutModel",
913
- "model_module_version": "1.2.0",
914
- "state": {
915
- "_model_module": "@jupyter-widgets/base",
916
- "_model_module_version": "1.2.0",
917
- "_model_name": "LayoutModel",
918
- "_view_count": null,
919
- "_view_module": "@jupyter-widgets/base",
920
- "_view_module_version": "1.2.0",
921
- "_view_name": "LayoutView",
922
- "align_content": null,
923
- "align_items": null,
924
- "align_self": null,
925
- "border": null,
926
- "bottom": null,
927
- "display": null,
928
- "flex": null,
929
- "flex_flow": null,
930
- "grid_area": null,
931
- "grid_auto_columns": null,
932
- "grid_auto_flow": null,
933
- "grid_auto_rows": null,
934
- "grid_column": null,
935
- "grid_gap": null,
936
- "grid_row": null,
937
- "grid_template_areas": null,
938
- "grid_template_columns": null,
939
- "grid_template_rows": null,
940
- "height": null,
941
- "justify_content": null,
942
- "justify_items": null,
943
- "left": null,
944
- "margin": null,
945
- "max_height": null,
946
- "max_width": null,
947
- "min_height": null,
948
- "min_width": null,
949
- "object_fit": null,
950
- "object_position": null,
951
- "order": null,
952
- "overflow": null,
953
- "overflow_x": null,
954
- "overflow_y": null,
955
- "padding": null,
956
- "right": null,
957
- "top": null,
958
- "visibility": null,
959
- "width": null
960
- }
961
- },
962
- "9182ff55244542aa9f77a7fefa181f49": {
963
- "model_module": "@jupyter-widgets/controls",
964
- "model_name": "ProgressStyleModel",
965
- "model_module_version": "1.5.0",
966
- "state": {
967
- "_model_module": "@jupyter-widgets/controls",
968
- "_model_module_version": "1.5.0",
969
- "_model_name": "ProgressStyleModel",
970
- "_view_count": null,
971
- "_view_module": "@jupyter-widgets/base",
972
- "_view_module_version": "1.2.0",
973
- "_view_name": "StyleView",
974
- "bar_color": null,
975
- "description_width": ""
976
- }
977
- },
978
- "a9c504808b7c4b87919dfc976342fe0e": {
979
- "model_module": "@jupyter-widgets/base",
980
- "model_name": "LayoutModel",
981
- "model_module_version": "1.2.0",
982
- "state": {
983
- "_model_module": "@jupyter-widgets/base",
984
- "_model_module_version": "1.2.0",
985
- "_model_name": "LayoutModel",
986
- "_view_count": null,
987
- "_view_module": "@jupyter-widgets/base",
988
- "_view_module_version": "1.2.0",
989
- "_view_name": "LayoutView",
990
- "align_content": null,
991
- "align_items": null,
992
- "align_self": null,
993
- "border": null,
994
- "bottom": null,
995
- "display": null,
996
- "flex": null,
997
- "flex_flow": null,
998
- "grid_area": null,
999
- "grid_auto_columns": null,
1000
- "grid_auto_flow": null,
1001
- "grid_auto_rows": null,
1002
- "grid_column": null,
1003
- "grid_gap": null,
1004
- "grid_row": null,
1005
- "grid_template_areas": null,
1006
- "grid_template_columns": null,
1007
- "grid_template_rows": null,
1008
- "height": null,
1009
- "justify_content": null,
1010
- "justify_items": null,
1011
- "left": null,
1012
- "margin": null,
1013
- "max_height": null,
1014
- "max_width": null,
1015
- "min_height": null,
1016
- "min_width": null,
1017
- "object_fit": null,
1018
- "object_position": null,
1019
- "order": null,
1020
- "overflow": null,
1021
- "overflow_x": null,
1022
- "overflow_y": null,
1023
- "padding": null,
1024
- "right": null,
1025
- "top": null,
1026
- "visibility": null,
1027
- "width": null
1028
- }
1029
- },
1030
- "7f6e9e7d12574620a04e3ce7040f40d6": {
1031
- "model_module": "@jupyter-widgets/controls",
1032
- "model_name": "DescriptionStyleModel",
1033
- "model_module_version": "1.5.0",
1034
- "state": {
1035
- "_model_module": "@jupyter-widgets/controls",
1036
- "_model_module_version": "1.5.0",
1037
- "_model_name": "DescriptionStyleModel",
1038
- "_view_count": null,
1039
- "_view_module": "@jupyter-widgets/base",
1040
- "_view_module_version": "1.2.0",
1041
- "_view_name": "StyleView",
1042
- "description_width": ""
1043
- }
1044
- },
1045
- "0028087e124840ce93d36b8bd482bb57": {
1046
- "model_module": "@jupyter-widgets/controls",
1047
- "model_name": "HBoxModel",
1048
- "model_module_version": "1.5.0",
1049
- "state": {
1050
- "_dom_classes": [],
1051
- "_model_module": "@jupyter-widgets/controls",
1052
- "_model_module_version": "1.5.0",
1053
- "_model_name": "HBoxModel",
1054
- "_view_count": null,
1055
- "_view_module": "@jupyter-widgets/controls",
1056
- "_view_module_version": "1.5.0",
1057
- "_view_name": "HBoxView",
1058
- "box_style": "",
1059
- "children": [
1060
- "IPY_MODEL_b1e9160b4b4b45798d9519bdfc9495a8",
1061
- "IPY_MODEL_0bc64a9e7911471f87a0d96b1c7f0e92",
1062
- "IPY_MODEL_b1c1e8f2fc854d0699cb1db59cfae2a1"
1063
- ],
1064
- "layout": "IPY_MODEL_82d76c4cdcf14a4ba5f34b49e9bd66d8"
1065
- }
1066
- },
1067
- "b1e9160b4b4b45798d9519bdfc9495a8": {
1068
- "model_module": "@jupyter-widgets/controls",
1069
- "model_name": "HTMLModel",
1070
- "model_module_version": "1.5.0",
1071
- "state": {
1072
- "_dom_classes": [],
1073
- "_model_module": "@jupyter-widgets/controls",
1074
- "_model_module_version": "1.5.0",
1075
- "_model_name": "HTMLModel",
1076
- "_view_count": null,
1077
- "_view_module": "@jupyter-widgets/controls",
1078
- "_view_module_version": "1.5.0",
1079
- "_view_name": "HTMLView",
1080
- "description": "",
1081
- "description_tooltip": null,
1082
- "layout": "IPY_MODEL_a39ac82e411b481893061534b82783d6",
1083
- "placeholder": "​",
1084
- "style": "IPY_MODEL_f49d6a8841544fbeb1b3a01826d5d230",
1085
- "value": "label_encoder.txt: 100%"
1086
- }
1087
- },
1088
- "0bc64a9e7911471f87a0d96b1c7f0e92": {
1089
- "model_module": "@jupyter-widgets/controls",
1090
- "model_name": "FloatProgressModel",
1091
- "model_module_version": "1.5.0",
1092
- "state": {
1093
- "_dom_classes": [],
1094
- "_model_module": "@jupyter-widgets/controls",
1095
- "_model_module_version": "1.5.0",
1096
- "_model_name": "FloatProgressModel",
1097
- "_view_count": null,
1098
- "_view_module": "@jupyter-widgets/controls",
1099
- "_view_module_version": "1.5.0",
1100
- "_view_name": "ProgressView",
1101
- "bar_style": "success",
1102
- "description": "",
1103
- "description_tooltip": null,
1104
- "layout": "IPY_MODEL_8ef83c7b9f49497dbe1cfaa7a4f898b2",
1105
- "max": 788,
1106
- "min": 0,
1107
- "orientation": "horizontal",
1108
- "style": "IPY_MODEL_68339024f0bc410c8f1bd95184ff7d0b",
1109
- "value": 788
1110
- }
1111
- },
1112
- "b1c1e8f2fc854d0699cb1db59cfae2a1": {
1113
- "model_module": "@jupyter-widgets/controls",
1114
- "model_name": "HTMLModel",
1115
- "model_module_version": "1.5.0",
1116
- "state": {
1117
- "_dom_classes": [],
1118
- "_model_module": "@jupyter-widgets/controls",
1119
- "_model_module_version": "1.5.0",
1120
- "_model_name": "HTMLModel",
1121
- "_view_count": null,
1122
- "_view_module": "@jupyter-widgets/controls",
1123
- "_view_module_version": "1.5.0",
1124
- "_view_name": "HTMLView",
1125
- "description": "",
1126
- "description_tooltip": null,
1127
- "layout": "IPY_MODEL_93516c9e85bb4f82a493be0bcb25120a",
1128
- "placeholder": "​",
1129
- "style": "IPY_MODEL_57b73755ea0246d98995c774e129e422",
1130
- "value": " 788/788 [00:00<00:00, 86.7kB/s]"
1131
- }
1132
- },
1133
- "82d76c4cdcf14a4ba5f34b49e9bd66d8": {
1134
- "model_module": "@jupyter-widgets/base",
1135
- "model_name": "LayoutModel",
1136
- "model_module_version": "1.2.0",
1137
- "state": {
1138
- "_model_module": "@jupyter-widgets/base",
1139
- "_model_module_version": "1.2.0",
1140
- "_model_name": "LayoutModel",
1141
- "_view_count": null,
1142
- "_view_module": "@jupyter-widgets/base",
1143
- "_view_module_version": "1.2.0",
1144
- "_view_name": "LayoutView",
1145
- "align_content": null,
1146
- "align_items": null,
1147
- "align_self": null,
1148
- "border": null,
1149
- "bottom": null,
1150
- "display": null,
1151
- "flex": null,
1152
- "flex_flow": null,
1153
- "grid_area": null,
1154
- "grid_auto_columns": null,
1155
- "grid_auto_flow": null,
1156
- "grid_auto_rows": null,
1157
- "grid_column": null,
1158
- "grid_gap": null,
1159
- "grid_row": null,
1160
- "grid_template_areas": null,
1161
- "grid_template_columns": null,
1162
- "grid_template_rows": null,
1163
- "height": null,
1164
- "justify_content": null,
1165
- "justify_items": null,
1166
- "left": null,
1167
- "margin": null,
1168
- "max_height": null,
1169
- "max_width": null,
1170
- "min_height": null,
1171
- "min_width": null,
1172
- "object_fit": null,
1173
- "object_position": null,
1174
- "order": null,
1175
- "overflow": null,
1176
- "overflow_x": null,
1177
- "overflow_y": null,
1178
- "padding": null,
1179
- "right": null,
1180
- "top": null,
1181
- "visibility": null,
1182
- "width": null
1183
- }
1184
- },
1185
- "a39ac82e411b481893061534b82783d6": {
1186
- "model_module": "@jupyter-widgets/base",
1187
- "model_name": "LayoutModel",
1188
- "model_module_version": "1.2.0",
1189
- "state": {
1190
- "_model_module": "@jupyter-widgets/base",
1191
- "_model_module_version": "1.2.0",
1192
- "_model_name": "LayoutModel",
1193
- "_view_count": null,
1194
- "_view_module": "@jupyter-widgets/base",
1195
- "_view_module_version": "1.2.0",
1196
- "_view_name": "LayoutView",
1197
- "align_content": null,
1198
- "align_items": null,
1199
- "align_self": null,
1200
- "border": null,
1201
- "bottom": null,
1202
- "display": null,
1203
- "flex": null,
1204
- "flex_flow": null,
1205
- "grid_area": null,
1206
- "grid_auto_columns": null,
1207
- "grid_auto_flow": null,
1208
- "grid_auto_rows": null,
1209
- "grid_column": null,
1210
- "grid_gap": null,
1211
- "grid_row": null,
1212
- "grid_template_areas": null,
1213
- "grid_template_columns": null,
1214
- "grid_template_rows": null,
1215
- "height": null,
1216
- "justify_content": null,
1217
- "justify_items": null,
1218
- "left": null,
1219
- "margin": null,
1220
- "max_height": null,
1221
- "max_width": null,
1222
- "min_height": null,
1223
- "min_width": null,
1224
- "object_fit": null,
1225
- "object_position": null,
1226
- "order": null,
1227
- "overflow": null,
1228
- "overflow_x": null,
1229
- "overflow_y": null,
1230
- "padding": null,
1231
- "right": null,
1232
- "top": null,
1233
- "visibility": null,
1234
- "width": null
1235
- }
1236
- },
1237
- "f49d6a8841544fbeb1b3a01826d5d230": {
1238
- "model_module": "@jupyter-widgets/controls",
1239
- "model_name": "DescriptionStyleModel",
1240
- "model_module_version": "1.5.0",
1241
- "state": {
1242
- "_model_module": "@jupyter-widgets/controls",
1243
- "_model_module_version": "1.5.0",
1244
- "_model_name": "DescriptionStyleModel",
1245
- "_view_count": null,
1246
- "_view_module": "@jupyter-widgets/base",
1247
- "_view_module_version": "1.2.0",
1248
- "_view_name": "StyleView",
1249
- "description_width": ""
1250
- }
1251
- },
1252
- "8ef83c7b9f49497dbe1cfaa7a4f898b2": {
1253
- "model_module": "@jupyter-widgets/base",
1254
- "model_name": "LayoutModel",
1255
- "model_module_version": "1.2.0",
1256
- "state": {
1257
- "_model_module": "@jupyter-widgets/base",
1258
- "_model_module_version": "1.2.0",
1259
- "_model_name": "LayoutModel",
1260
- "_view_count": null,
1261
- "_view_module": "@jupyter-widgets/base",
1262
- "_view_module_version": "1.2.0",
1263
- "_view_name": "LayoutView",
1264
- "align_content": null,
1265
- "align_items": null,
1266
- "align_self": null,
1267
- "border": null,
1268
- "bottom": null,
1269
- "display": null,
1270
- "flex": null,
1271
- "flex_flow": null,
1272
- "grid_area": null,
1273
- "grid_auto_columns": null,
1274
- "grid_auto_flow": null,
1275
- "grid_auto_rows": null,
1276
- "grid_column": null,
1277
- "grid_gap": null,
1278
- "grid_row": null,
1279
- "grid_template_areas": null,
1280
- "grid_template_columns": null,
1281
- "grid_template_rows": null,
1282
- "height": null,
1283
- "justify_content": null,
1284
- "justify_items": null,
1285
- "left": null,
1286
- "margin": null,
1287
- "max_height": null,
1288
- "max_width": null,
1289
- "min_height": null,
1290
- "min_width": null,
1291
- "object_fit": null,
1292
- "object_position": null,
1293
- "order": null,
1294
- "overflow": null,
1295
- "overflow_x": null,
1296
- "overflow_y": null,
1297
- "padding": null,
1298
- "right": null,
1299
- "top": null,
1300
- "visibility": null,
1301
- "width": null
1302
- }
1303
- },
1304
- "68339024f0bc410c8f1bd95184ff7d0b": {
1305
- "model_module": "@jupyter-widgets/controls",
1306
- "model_name": "ProgressStyleModel",
1307
- "model_module_version": "1.5.0",
1308
- "state": {
1309
- "_model_module": "@jupyter-widgets/controls",
1310
- "_model_module_version": "1.5.0",
1311
- "_model_name": "ProgressStyleModel",
1312
- "_view_count": null,
1313
- "_view_module": "@jupyter-widgets/base",
1314
- "_view_module_version": "1.2.0",
1315
- "_view_name": "StyleView",
1316
- "bar_color": null,
1317
- "description_width": ""
1318
- }
1319
- },
1320
- "93516c9e85bb4f82a493be0bcb25120a": {
1321
- "model_module": "@jupyter-widgets/base",
1322
- "model_name": "LayoutModel",
1323
- "model_module_version": "1.2.0",
1324
- "state": {
1325
- "_model_module": "@jupyter-widgets/base",
1326
- "_model_module_version": "1.2.0",
1327
- "_model_name": "LayoutModel",
1328
- "_view_count": null,
1329
- "_view_module": "@jupyter-widgets/base",
1330
- "_view_module_version": "1.2.0",
1331
- "_view_name": "LayoutView",
1332
- "align_content": null,
1333
- "align_items": null,
1334
- "align_self": null,
1335
- "border": null,
1336
- "bottom": null,
1337
- "display": null,
1338
- "flex": null,
1339
- "flex_flow": null,
1340
- "grid_area": null,
1341
- "grid_auto_columns": null,
1342
- "grid_auto_flow": null,
1343
- "grid_auto_rows": null,
1344
- "grid_column": null,
1345
- "grid_gap": null,
1346
- "grid_row": null,
1347
- "grid_template_areas": null,
1348
- "grid_template_columns": null,
1349
- "grid_template_rows": null,
1350
- "height": null,
1351
- "justify_content": null,
1352
- "justify_items": null,
1353
- "left": null,
1354
- "margin": null,
1355
- "max_height": null,
1356
- "max_width": null,
1357
- "min_height": null,
1358
- "min_width": null,
1359
- "object_fit": null,
1360
- "object_position": null,
1361
- "order": null,
1362
- "overflow": null,
1363
- "overflow_x": null,
1364
- "overflow_y": null,
1365
- "padding": null,
1366
- "right": null,
1367
- "top": null,
1368
- "visibility": null,
1369
- "width": null
1370
- }
1371
- },
1372
- "57b73755ea0246d98995c774e129e422": {
1373
- "model_module": "@jupyter-widgets/controls",
1374
- "model_name": "DescriptionStyleModel",
1375
- "model_module_version": "1.5.0",
1376
- "state": {
1377
- "_model_module": "@jupyter-widgets/controls",
1378
- "_model_module_version": "1.5.0",
1379
- "_model_name": "DescriptionStyleModel",
1380
- "_view_count": null,
1381
- "_view_module": "@jupyter-widgets/base",
1382
- "_view_module_version": "1.2.0",
1383
- "_view_name": "StyleView",
1384
- "description_width": ""
1385
- }
1386
- }
1387
- }
1388
- }
1389
- },
1390
- "cells": [
1391
- {
1392
- "cell_type": "code",
1393
- "execution_count": 1,
1394
- "metadata": {
1395
- "colab": {
1396
- "base_uri": "https://localhost:8080/"
1397
- },
1398
- "id": "gB5y6aC-H5_R",
1399
- "outputId": "3331d670-461e-4aba-eb3d-6f28d3c66377"
1400
- },
1401
- "outputs": [
1402
- {
1403
- "output_type": "stream",
1404
- "name": "stdout",
1405
- "text": [
1406
- "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m174.3/174.3 kB\u001b[0m \u001b[31m4.6 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
1407
- "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m44.3/44.3 kB\u001b[0m \u001b[31m2.7 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
1408
- "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m3.3/3.3 MB\u001b[0m \u001b[31m59.5 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
1409
- "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m363.4/363.4 MB\u001b[0m \u001b[31m3.7 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
1410
- "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m13.8/13.8 MB\u001b[0m \u001b[31m101.9 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
1411
- "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m24.6/24.6 MB\u001b[0m \u001b[31m92.5 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
1412
- "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m883.7/883.7 kB\u001b[0m \u001b[31m57.9 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
1413
- "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m664.8/664.8 MB\u001b[0m \u001b[31m2.9 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
1414
- "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m211.5/211.5 MB\u001b[0m \u001b[31m5.5 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
1415
- "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m56.3/56.3 MB\u001b[0m \u001b[31m12.9 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
1416
- "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m127.9/127.9 MB\u001b[0m \u001b[31m7.5 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
1417
- "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m207.5/207.5 MB\u001b[0m \u001b[31m5.7 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
1418
- "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m21.1/21.1 MB\u001b[0m \u001b[31m84.4 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
1419
- "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m9.9/9.9 MB\u001b[0m \u001b[31m93.4 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
1420
- "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m864.1/864.1 kB\u001b[0m \u001b[31m42.8 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
1421
- "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m6.9/6.9 MB\u001b[0m \u001b[31m132.0 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
1422
- "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m79.1/79.1 kB\u001b[0m \u001b[31m7.8 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
1423
- "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m118.3/118.3 kB\u001b[0m \u001b[31m11.5 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
1424
- "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m739.1/739.1 kB\u001b[0m \u001b[31m53.7 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
1425
- "\u001b[?25h"
1426
- ]
1427
- }
1428
- ],
1429
- "source": [
1430
- "# Install needed libraries (run this cell first!)\n",
1431
- "!pip install --quiet yt-dlp ffmpeg-python torch torchaudio transformers streamlit speechbrain\n"
1432
- ]
1433
- },
1434
- {
1435
- "cell_type": "code",
1436
- "source": [
1437
- "import os\n",
1438
- "import subprocess\n",
1439
- "import torchaudio\n",
1440
- "import torch\n",
1441
- "from speechbrain.pretrained import EncoderClassifier\n",
1442
- "import yt_dlp\n"
1443
- ],
1444
- "metadata": {
1445
- "colab": {
1446
- "base_uri": "https://localhost:8080/"
1447
- },
1448
- "id": "BDKT_c4rI07R",
1449
- "outputId": "8083d2c5-eade-4424-db57-a640ce85bcb8"
1450
- },
1451
- "execution_count": 5,
1452
- "outputs": [
1453
- {
1454
- "output_type": "stream",
1455
- "name": "stderr",
1456
- "text": [
1457
- "DEBUG:speechbrain.utils.checkpoints:Registered checkpoint save hook for _speechbrain_save\n",
1458
- "DEBUG:speechbrain.utils.checkpoints:Registered checkpoint load hook for _speechbrain_load\n",
1459
- "DEBUG:speechbrain.utils.checkpoints:Registered checkpoint save hook for save\n",
1460
- "DEBUG:speechbrain.utils.checkpoints:Registered checkpoint load hook for load\n",
1461
- "DEBUG:speechbrain.utils.checkpoints:Registered checkpoint save hook for _save\n",
1462
- "DEBUG:speechbrain.utils.checkpoints:Registered checkpoint load hook for _recover\n",
1463
- "<ipython-input-5-0f12fb55d26c>:5: UserWarning: Module 'speechbrain.pretrained' was deprecated, redirecting to 'speechbrain.inference'. Please update your script. This is a change from SpeechBrain 1.0. See: https://github.com/speechbrain/speechbrain/releases/tag/v1.0.0\n",
1464
- " from speechbrain.pretrained import EncoderClassifier\n"
1465
- ]
1466
- }
1467
- ]
1468
- },
1469
- {
1470
- "cell_type": "code",
1471
- "source": [
1472
- "# Paste your video URL here (YouTube or direct MP4 link)\n",
1473
- "VIDEO_URL = \"https://youtu.be/DDjWTWHHkpk?si=oIj6Fuy8Hg2E8U_l\" # Example: Replace with your actual link!\n"
1474
- ],
1475
- "metadata": {
1476
- "id": "dco77Q2CI45K"
1477
- },
1478
- "execution_count": 2,
1479
- "outputs": []
1480
- },
1481
- {
1482
- "cell_type": "code",
1483
- "source": [
1484
- "def download_video(url, out_path=\"input_video.mp4\"):\n",
1485
- " \"\"\"\n",
1486
- " Downloads a video from YouTube or direct MP4 link.\n",
1487
- " Returns the filename of the downloaded video.\n",
1488
- " \"\"\"\n",
1489
- " # If it's a YouTube link, use yt-dlp\n",
1490
- " if \"youtube.com\" in url or \"youtu.be\" in url:\n",
1491
- " ydl_opts = {'outtmpl': out_path}\n",
1492
- " with yt_dlp.YoutubeDL(ydl_opts) as ydl:\n",
1493
- " ydl.download([url])\n",
1494
- " else:\n",
1495
- " # For direct links, use wget/curl fallback\n",
1496
- " os.system(f\"wget -O {out_path} {url}\")\n",
1497
- " return out_path\n",
1498
- "\n",
1499
- "video_file = download_video(VIDEO_URL)\n",
1500
- "print(f\"Downloaded video: {video_file}\")\n"
1501
- ],
1502
- "metadata": {
1503
- "colab": {
1504
- "base_uri": "https://localhost:8080/"
1505
- },
1506
- "id": "RpWlsFnUJECZ",
1507
- "outputId": "c8795ebf-01de-40ae-c80c-02cfa09a1357"
1508
- },
1509
- "execution_count": 6,
1510
- "outputs": [
1511
- {
1512
- "output_type": "stream",
1513
- "name": "stdout",
1514
- "text": [
1515
- "[youtube] Extracting URL: https://youtu.be/DDjWTWHHkpk?si=oIj6Fuy8Hg2E8U_l\n",
1516
- "[youtube] DDjWTWHHkpk: Downloading webpage\n",
1517
- "[youtube] DDjWTWHHkpk: Downloading tv client config\n",
1518
- "[youtube] DDjWTWHHkpk: Downloading player f203bbc8-main\n",
1519
- "[youtube] DDjWTWHHkpk: Downloading tv player API JSON\n",
1520
- "[youtube] DDjWTWHHkpk: Downloading ios player API JSON\n",
1521
- "[youtube] DDjWTWHHkpk: Downloading m3u8 information\n",
1522
- "[info] DDjWTWHHkpk: Downloading 1 format(s): 399+251\n",
1523
- "[download] Destination: input_video.mp4.f399.mp4\n",
1524
- "[download] 100% of 62.45MiB in 00:00:01 at 31.78MiB/s \n",
1525
- "[download] Destination: input_video.mp4.f251.webm\n",
1526
- "[download] 100% of 4.57MiB in 00:00:00 at 9.99MiB/s \n",
1527
- "[Merger] Merging formats into \"input_video.mp4.webm\"\n",
1528
- "Deleting original file input_video.mp4.f399.mp4 (pass -k to keep)\n",
1529
- "Deleting original file input_video.mp4.f251.webm (pass -k to keep)\n",
1530
- "Downloaded video: input_video.mp4\n"
1531
- ]
1532
- }
1533
- ]
1534
- },
1535
- {
1536
- "cell_type": "code",
1537
- "source": [
1538
- "def extract_audio(video_path, audio_path=\"audio.wav\"):\n",
1539
- " \"\"\"\n",
1540
- " Extracts audio from a video file using ffmpeg.\n",
1541
- " Returns the filename of the audio file.\n",
1542
- " \"\"\"\n",
1543
- " # Remove if already exists\n",
1544
- " if os.path.exists(audio_path):\n",
1545
- " os.remove(audio_path)\n",
1546
- " # Extract audio with ffmpeg\n",
1547
- " cmd = f\"ffmpeg -y -i {video_path} -ar 16000 -ac 1 -vn {audio_path}\"\n",
1548
- " subprocess.call(cmd, shell=True)\n",
1549
- " return audio_path\n",
1550
- "\n",
1551
- "audio_file = extract_audio(video_file)\n",
1552
- "print(f\"Extracted audio file: {audio_file}\")\n"
1553
- ],
1554
- "metadata": {
1555
- "colab": {
1556
- "base_uri": "https://localhost:8080/"
1557
- },
1558
- "id": "4a40jh5sJLMR",
1559
- "outputId": "9756fbf1-2666-4271-bfd4-78de81d92b27"
1560
- },
1561
- "execution_count": 7,
1562
- "outputs": [
1563
- {
1564
- "output_type": "stream",
1565
- "name": "stdout",
1566
- "text": [
1567
- "Extracted audio file: audio.wav\n"
1568
- ]
1569
- }
1570
- ]
1571
- },
1572
- {
1573
- "cell_type": "code",
1574
- "source": [
1575
- "def extract_audio(video_path, audio_path=\"/content/audio.wav\"):\n",
1576
- " \"\"\"\n",
1577
- " Extracts audio from a video file using ffmpeg.\n",
1578
- " Returns the filename of the audio file.\n",
1579
- " \"\"\"\n",
1580
- " # Remove if already exists\n",
1581
- " if os.path.exists(audio_path):\n",
1582
- " os.remove(audio_path)\n",
1583
- " # Extract audio with ffmpeg\n",
1584
- " cmd = f\"ffmpeg -y -i {video_path} -ar 16000 -ac 1 -vn {audio_path}\"\n",
1585
- " # Use subprocess.run to capture output and check the return code\n",
1586
- " result = subprocess.run(cmd, shell=True, capture_output=True, text=True)\n",
1587
- "\n",
1588
- " if result.returncode != 0:\n",
1589
- " print(f\"FFmpeg command failed with error code {result.returncode}\")\n",
1590
- " print(\"FFmpeg stderr:\")\n",
1591
- " print(result.stderr)\n",
1592
- " # Optionally, raise an error or exit if audio extraction fails\n",
1593
- " raise RuntimeError(f\"Failed to extract audio using FFmpeg. See stderr above.\")\n",
1594
- " else:\n",
1595
- " print(\"FFmpeg stdout:\")\n",
1596
- " print(result.stdout)\n",
1597
- " print(\"FFmpeg stderr:\")\n",
1598
- " print(result.stderr) # ffmpeg often outputs info/warnings to stderr\n",
1599
- "\n",
1600
- " # Check if the audio file was actually created\n",
1601
- " if not os.path.exists(audio_path):\n",
1602
- " raise FileNotFoundError(f\"Audio file '{audio_path}' was not created after FFmpeg execution.\")\n",
1603
- "\n",
1604
- " return audio_path"
1605
- ],
1606
- "metadata": {
1607
- "id": "ID_TzSsMJsqF"
1608
- },
1609
- "execution_count": 8,
1610
- "outputs": []
1611
- },
1612
- {
1613
- "cell_type": "code",
1614
- "source": [
1615
- "# Download the pre-trained English accent classifier (SpeechBrain)\n",
1616
- "accent_model = EncoderClassifier.from_hparams(\n",
1617
- " source=\"speechbrain/lang-id-commonlanguage_ecapa\",\n",
1618
- " savedir=\"tmp_accent_model\"\n",
1619
- ")\n"
1620
- ],
1621
- "metadata": {
1622
- "colab": {
1623
- "base_uri": "https://localhost:8080/",
1624
- "height": 599,
1625
- "referenced_widgets": [
1626
- "025b845ba49e423cbfc757252db02381",
1627
- "e29ef8d387a94e6990343111c600d40f",
1628
- "bd085d627a404aac90bb6336f74d22a9",
1629
- "06c62bd2fcc346a197c3579d00ca0d44",
1630
- "df3990918f424c60be35b4c5be90ac34",
1631
- "3c88eea7ce64430e94e998a81463143e",
1632
- "0f38dc6f89064ec49950502e32a5cc53",
1633
- "f6d0a0357ac048d9ad5ef31056fb65a1",
1634
- "a570c3b7f01a4906a51eff36d264bb26",
1635
- "4e352cff53fa49069d0131578fd3248d",
1636
- "2ca94275b52b488fa7755de3c7b03216",
1637
- "d7a05ee4c7c24eacbddf57ab6644639b",
1638
- "9e2406e1e42d42068d99c706484bab9a",
1639
- "2d49939f1d264b59906278bf4939ab2a",
1640
- "87a3a050b04e4e5b941951780926d36c",
1641
- "f0d5a89ad850448abcd506d6de86fff9",
1642
- "16ccf523e9c24390ba654e282241831d",
1643
- "25da015c20f8426db38b3853245b37a4",
1644
- "77c6272fc49448529d7a7a919b1cc418",
1645
- "a9c2643b4c3f4af7b54b9c3940377519",
1646
- "75b859dc0f5642408cf318d6583a8da3",
1647
- "424c140f22c142988c5e95114c4680d7",
1648
- "a0ae653cdf364d528ff132a48c1020c4",
1649
- "353f33d613d34b13944aaca5017752e1",
1650
- "bb24cf37e9d948bb81527968af1194c9",
1651
- "c2e2a5f07c594707a215a3f3c5e673b9",
1652
- "ae843746277c43e5bbe68390ad8ea887",
1653
- "901c650e39ea4ddc8148e80f087b40e5",
1654
- "71ffe21e8fe04be3ab6bfb4c10ae2403",
1655
- "a749c4a8500c45c4b083918cac225bc0",
1656
- "9182ff55244542aa9f77a7fefa181f49",
1657
- "a9c504808b7c4b87919dfc976342fe0e",
1658
- "7f6e9e7d12574620a04e3ce7040f40d6",
1659
- "0028087e124840ce93d36b8bd482bb57",
1660
- "b1e9160b4b4b45798d9519bdfc9495a8",
1661
- "0bc64a9e7911471f87a0d96b1c7f0e92",
1662
- "b1c1e8f2fc854d0699cb1db59cfae2a1",
1663
- "82d76c4cdcf14a4ba5f34b49e9bd66d8",
1664
- "a39ac82e411b481893061534b82783d6",
1665
- "f49d6a8841544fbeb1b3a01826d5d230",
1666
- "8ef83c7b9f49497dbe1cfaa7a4f898b2",
1667
- "68339024f0bc410c8f1bd95184ff7d0b",
1668
- "93516c9e85bb4f82a493be0bcb25120a",
1669
- "57b73755ea0246d98995c774e129e422"
1670
- ]
1671
- },
1672
- "id": "NioBBuqiJSyA",
1673
- "outputId": "01d37290-1a05-42d0-b74c-587eb8a71885"
1674
- },
1675
- "execution_count": 9,
1676
- "outputs": [
1677
- {
1678
- "output_type": "stream",
1679
- "name": "stderr",
1680
- "text": [
1681
- "INFO:speechbrain.utils.fetching:Fetch hyperparams.yaml: Fetching from HuggingFace Hub 'speechbrain/lang-id-commonlanguage_ecapa' if not cached\n"
1682
- ]
1683
- },
1684
- {
1685
- "output_type": "display_data",
1686
- "data": {
1687
- "text/plain": [
1688
- "hyperparams.yaml: 0%| | 0.00/1.67k [00:00<?, ?B/s]"
1689
- ],
1690
- "application/vnd.jupyter.widget-view+json": {
1691
- "version_major": 2,
1692
- "version_minor": 0,
1693
- "model_id": "025b845ba49e423cbfc757252db02381"
1694
- }
1695
- },
1696
- "metadata": {}
1697
- },
1698
- {
1699
- "output_type": "stream",
1700
- "name": "stderr",
1701
- "text": [
1702
- "DEBUG:speechbrain.utils.fetching:Fetch: Local file found, creating symlink '/root/.cache/huggingface/hub/models--speechbrain--lang-id-commonlanguage_ecapa/snapshots/9d809a7e1fdf48afa53e1b41ee8ae0af9ce46308/hyperparams.yaml' -> '/content/tmp_accent_model/hyperparams.yaml'\n",
1703
- "INFO:speechbrain.utils.fetching:Fetch custom.py: Fetching from HuggingFace Hub 'speechbrain/lang-id-commonlanguage_ecapa' if not cached\n",
1704
- "DEBUG:speechbrain.utils.checkpoints:Registered checkpoint save hook for _save\n",
1705
- "DEBUG:speechbrain.utils.checkpoints:Registered checkpoint load hook for _load\n",
1706
- "DEBUG:speechbrain.utils.checkpoints:Registered parameter transfer hook for _load\n",
1707
- "/usr/local/lib/python3.11/dist-packages/speechbrain/utils/autocast.py:188: FutureWarning: `torch.cuda.amp.custom_fwd(args...)` is deprecated. Please use `torch.amp.custom_fwd(args..., device_type='cuda')` instead.\n",
1708
- " wrapped_fwd = torch.cuda.amp.custom_fwd(fwd, cast_inputs=cast_inputs)\n",
1709
- "DEBUG:speechbrain.utils.checkpoints:Registered checkpoint save hook for save\n",
1710
- "DEBUG:speechbrain.utils.checkpoints:Registered checkpoint load hook for load_if_possible\n",
1711
- "DEBUG:speechbrain.utils.parameter_transfer:Collecting files (or symlinks) for pretraining in tmp_accent_model.\n",
1712
- "INFO:speechbrain.utils.fetching:Fetch embedding_model.ckpt: Fetching from HuggingFace Hub 'speechbrain/lang-id-commonlanguage_ecapa' if not cached\n"
1713
- ]
1714
- },
1715
- {
1716
- "output_type": "display_data",
1717
- "data": {
1718
- "text/plain": [
1719
- "embedding_model.ckpt: 0%| | 0.00/83.3M [00:00<?, ?B/s]"
1720
- ],
1721
- "application/vnd.jupyter.widget-view+json": {
1722
- "version_major": 2,
1723
- "version_minor": 0,
1724
- "model_id": "d7a05ee4c7c24eacbddf57ab6644639b"
1725
- }
1726
- },
1727
- "metadata": {}
1728
- },
1729
- {
1730
- "output_type": "stream",
1731
- "name": "stderr",
1732
- "text": [
1733
- "DEBUG:speechbrain.utils.fetching:Fetch: Local file found, creating symlink '/root/.cache/huggingface/hub/models--speechbrain--lang-id-commonlanguage_ecapa/snapshots/9d809a7e1fdf48afa53e1b41ee8ae0af9ce46308/embedding_model.ckpt' -> '/content/tmp_accent_model/embedding_model.ckpt'\n",
1734
- "DEBUG:speechbrain.utils.parameter_transfer:Set local path in self.paths[\"embedding_model\"] = /content/tmp_accent_model/embedding_model.ckpt\n",
1735
- "INFO:speechbrain.utils.fetching:Fetch classifier.ckpt: Fetching from HuggingFace Hub 'speechbrain/lang-id-commonlanguage_ecapa' if not cached\n"
1736
- ]
1737
- },
1738
- {
1739
- "output_type": "display_data",
1740
- "data": {
1741
- "text/plain": [
1742
- "classifier.ckpt: 0%| | 0.00/35.4k [00:00<?, ?B/s]"
1743
- ],
1744
- "application/vnd.jupyter.widget-view+json": {
1745
- "version_major": 2,
1746
- "version_minor": 0,
1747
- "model_id": "a0ae653cdf364d528ff132a48c1020c4"
1748
- }
1749
- },
1750
- "metadata": {}
1751
- },
1752
- {
1753
- "output_type": "stream",
1754
- "name": "stderr",
1755
- "text": [
1756
- "DEBUG:speechbrain.utils.fetching:Fetch: Local file found, creating symlink '/root/.cache/huggingface/hub/models--speechbrain--lang-id-commonlanguage_ecapa/snapshots/9d809a7e1fdf48afa53e1b41ee8ae0af9ce46308/classifier.ckpt' -> '/content/tmp_accent_model/classifier.ckpt'\n",
1757
- "DEBUG:speechbrain.utils.parameter_transfer:Set local path in self.paths[\"classifier\"] = /content/tmp_accent_model/classifier.ckpt\n",
1758
- "INFO:speechbrain.utils.fetching:Fetch label_encoder.txt: Fetching from HuggingFace Hub 'speechbrain/lang-id-commonlanguage_ecapa' if not cached\n"
1759
- ]
1760
- },
1761
- {
1762
- "output_type": "display_data",
1763
- "data": {
1764
- "text/plain": [
1765
- "label_encoder.txt: 0%| | 0.00/788 [00:00<?, ?B/s]"
1766
- ],
1767
- "application/vnd.jupyter.widget-view+json": {
1768
- "version_major": 2,
1769
- "version_minor": 0,
1770
- "model_id": "0028087e124840ce93d36b8bd482bb57"
1771
- }
1772
- },
1773
- "metadata": {}
1774
- },
1775
- {
1776
- "output_type": "stream",
1777
- "name": "stderr",
1778
- "text": [
1779
- "DEBUG:speechbrain.utils.fetching:Fetch: Local file found, creating symlink '/root/.cache/huggingface/hub/models--speechbrain--lang-id-commonlanguage_ecapa/snapshots/9d809a7e1fdf48afa53e1b41ee8ae0af9ce46308/label_encoder.txt' -> '/content/tmp_accent_model/label_encoder.ckpt'\n",
1780
- "DEBUG:speechbrain.utils.parameter_transfer:Set local path in self.paths[\"label_encoder\"] = /content/tmp_accent_model/label_encoder.ckpt\n",
1781
- "INFO:speechbrain.utils.parameter_transfer:Loading pretrained files for: embedding_model, classifier, label_encoder\n",
1782
- "DEBUG:speechbrain.utils.parameter_transfer:Redirecting (loading from local path): embedding_model -> /content/tmp_accent_model/embedding_model.ckpt\n",
1783
- "DEBUG:speechbrain.utils.parameter_transfer:Redirecting (loading from local path): classifier -> /content/tmp_accent_model/classifier.ckpt\n",
1784
- "DEBUG:speechbrain.utils.parameter_transfer:Redirecting (loading from local path): label_encoder -> /content/tmp_accent_model/label_encoder.ckpt\n",
1785
- "DEBUG:speechbrain.dataio.encoder:Loaded categorical encoding from /content/tmp_accent_model/label_encoder.ckpt\n"
1786
- ]
1787
- }
1788
- ]
1789
- },
1790
- {
1791
- "cell_type": "markdown",
1792
- "source": [
1793
- "Used to Debuging the code"
1794
- ],
1795
- "metadata": {
1796
- "id": "Tu9Wo4k6K-EK"
1797
- }
1798
- },
1799
- {
1800
- "cell_type": "code",
1801
- "source": [
1802
- "# List the files to see if input_video.mp4 is present\n",
1803
- "import os\n",
1804
- "print(os.listdir('.'))\n"
1805
- ],
1806
- "metadata": {
1807
- "colab": {
1808
- "base_uri": "https://localhost:8080/"
1809
- },
1810
- "id": "iuY4MTUmKDmx",
1811
- "outputId": "e325dbb9-3e01-4e17-a832-3180a8c809e3"
1812
- },
1813
- "execution_count": 10,
1814
- "outputs": [
1815
- {
1816
- "output_type": "stream",
1817
- "name": "stdout",
1818
- "text": [
1819
- "['.config', 'tmp_accent_model', 'input_video.mp4.webm', 'sample_data']\n"
1820
- ]
1821
- }
1822
- ]
1823
- },
1824
- {
1825
- "cell_type": "markdown",
1826
- "source": [
1827
- "TO check the debug file path"
1828
- ],
1829
- "metadata": {
1830
- "id": "H2pjikAiLCqM"
1831
- }
1832
- },
1833
- {
1834
- "cell_type": "code",
1835
- "source": [
1836
- "# Try extracting audio again, but print output to check for errors\n",
1837
- "video_path = \"/content/input_video.mp4.webm\" # or whatever your filename is!\n",
1838
- "audio_path = \"audio.wav\"\n",
1839
- "\n",
1840
- "os.system(f\"ffmpeg -y -i {video_path} -ar 16000 -ac 1 -vn {audio_path}\")\n",
1841
- "\n",
1842
- "# See if audio.wav was created\n",
1843
- "print(os.listdir('.'))\n"
1844
- ],
1845
- "metadata": {
1846
- "colab": {
1847
- "base_uri": "https://localhost:8080/"
1848
- },
1849
- "id": "_5huLKQoKMec",
1850
- "outputId": "fca4a365-4745-46f0-cf29-80f754af6c59"
1851
- },
1852
- "execution_count": 11,
1853
- "outputs": [
1854
- {
1855
- "output_type": "stream",
1856
- "name": "stdout",
1857
- "text": [
1858
- "['.config', 'tmp_accent_model', 'input_video.mp4.webm', 'audio.wav', 'sample_data']\n"
1859
- ]
1860
- }
1861
- ]
1862
- },
1863
- {
1864
- "cell_type": "markdown",
1865
- "source": [
1866
- "Check the Size of the file"
1867
- ],
1868
- "metadata": {
1869
- "id": "6tbUtgFDLGQq"
1870
- }
1871
- },
1872
- {
1873
- "cell_type": "code",
1874
- "source": [
1875
- "# Check if the file now exists and get its size\n",
1876
- "import os\n",
1877
- "print(\"audio.wav exists:\", os.path.exists(audio_path))\n",
1878
- "if os.path.exists(audio_path):\n",
1879
- " print(\"audio.wav size (bytes):\", os.path.getsize(audio_path))\n"
1880
- ],
1881
- "metadata": {
1882
- "colab": {
1883
- "base_uri": "https://localhost:8080/"
1884
- },
1885
- "id": "dnyXSxAmKZN2",
1886
- "outputId": "9616b8da-62c3-4a77-8983-16a193f7ee0f"
1887
- },
1888
- "execution_count": 12,
1889
- "outputs": [
1890
- {
1891
- "output_type": "stream",
1892
- "name": "stdout",
1893
- "text": [
1894
- "audio.wav exists: True\n",
1895
- "audio.wav size (bytes): 9308494\n"
1896
- ]
1897
- }
1898
- ]
1899
- },
1900
- {
1901
- "cell_type": "code",
1902
- "source": [
1903
- "# Load the audio file (must be 16kHz mono)\n",
1904
- "signal, fs = torchaudio.load(audio_file)\n",
1905
- "\n",
1906
- "# If stereo, take only the first channel\n",
1907
- "if signal.shape[0] > 1:\n",
1908
- " signal = signal[0].unsqueeze(0)\n",
1909
- "\n",
1910
- "# Run classification\n",
1911
- "prediction = accent_model.classify_batch(signal)\n",
1912
- "pred_label = prediction[3][0]\n",
1913
- "pred_scores = prediction[1][0]\n",
1914
- "\n",
1915
- "# Convert score to percentage\n",
1916
- "confidence = float(pred_scores.max()) * 100\n",
1917
- "\n",
1918
- "# Display top label and score\n",
1919
- "print(f\"Predicted Accent: {pred_label}\")\n",
1920
- "print(f\"Confidence: {confidence:.1f}%\")\n",
1921
- "print(\"Possible accent labels:\", accent_model.hparams.label_encoder.lab2ind.keys())\n",
1922
- "\n"
1923
- ],
1924
- "metadata": {
1925
- "colab": {
1926
- "base_uri": "https://localhost:8080/"
1927
- },
1928
- "id": "dib87e25JZkd",
1929
- "outputId": "1ddd1991-148b-461b-94d4-845c401365d7"
1930
- },
1931
- "execution_count": 13,
1932
- "outputs": [
1933
- {
1934
- "output_type": "stream",
1935
- "name": "stderr",
1936
- "text": [
1937
- "WARNING:speechbrain.dataio.encoder:CategoricalEncoder.expect_len was never called: assuming category count of 45 to be correct! Sanity check your encoder using `.expect_len`. Ensure that downstream code also uses the correct size. If you are sure this does not apply to you, use `.ignore_len`.\n"
1938
- ]
1939
- },
1940
- {
1941
- "output_type": "stream",
1942
- "name": "stdout",
1943
- "text": [
1944
- "Predicted Accent: English\n",
1945
- "Confidence: 66.8%\n",
1946
- "Possible accent labels: dict_keys(['Basque', 'Romansh_Sursilvan', 'Sakha', 'Georgian', 'Greek', 'Hakha_Chin', 'Ukrainian', 'Interlingua', 'Persian', 'Polish', 'Dutch', 'Chinese_Hongkong', 'Japanese', 'Portuguese', 'Italian', 'Catalan', 'Chuvash', 'Swedish', 'Spanish', 'Slovenian', 'Tamil', 'Breton', 'Russian', 'Czech', 'English', 'French', 'Tatar', 'Welsh', 'Kyrgyz', 'Esperanto', 'Kinyarwanda', 'Dhivehi', 'Turkish', 'Latvian', 'Estonian', 'Arabic', 'Frisian', 'Mongolian', 'Chinese_Taiwan', 'Indonesian', 'Maltese', 'Kabyle', 'Romanian', 'Chinese_China', 'German'])\n"
1947
- ]
1948
- }
1949
- ]
1950
- },
1951
- {
1952
- "cell_type": "code",
1953
- "source": [
1954
- "explanation = f\"The speaker's English accent was classified as '{pred_label}' with a confidence score of {confidence:.1f}%. This means the model is {confidence:.0f}% sure the person sounds most similar to this accent group.\"\n",
1955
- "\n",
1956
- "print(explanation)\n"
1957
- ],
1958
- "metadata": {
1959
- "colab": {
1960
- "base_uri": "https://localhost:8080/"
1961
- },
1962
- "id": "YchZqUzSLna9",
1963
- "outputId": "91d6f6ae-0247-4e0e-a9c1-d0e9d379a8e0"
1964
- },
1965
- "execution_count": 14,
1966
- "outputs": [
1967
- {
1968
- "output_type": "stream",
1969
- "name": "stdout",
1970
- "text": [
1971
- "The speaker's English accent was classified as 'English' with a confidence score of 66.8%. This means the model is 67% sure the person sounds most similar to this accent group.\n"
1972
- ]
1973
- }
1974
- ]
1975
- },
1976
- {
1977
- "cell_type": "code",
1978
- "source": [
1979
- "# Save as app.py in Colab for launching a simple web UI\n",
1980
- "with open(\"app.py\", \"w\") as f:\n",
1981
- " f.write('''\n",
1982
- "import streamlit as st\n",
1983
- "import os\n",
1984
- "import subprocess\n",
1985
- "import torchaudio\n",
1986
- "from speechbrain.pretrained import EncoderClassifier\n",
1987
- "\n",
1988
- "st.title(\"🗣️ English Accent Classifier (Proof of Concept)\")\n",
1989
- "\n",
1990
- "url = st.text_input(\"Enter public video URL (YouTube or direct MP4):\")\n",
1991
- "if st.button(\"Analyze\"):\n",
1992
- " with st.spinner(\"Downloading video...\"):\n",
1993
- " if \"youtube.com\" in url or \"youtu.be\" in url:\n",
1994
- " os.system(f'yt-dlp -o input_video.mp4 \"{url}\"')\n",
1995
- " else:\n",
1996
- " os.system(f'wget -O input_video.mp4 \"{url}\"')\n",
1997
- " with st.spinner(\"Extracting audio...\"):\n",
1998
- " os.system(\"ffmpeg -y -i input_video.mp4 -ar 16000 -ac 1 -vn audio.wav\")\n",
1999
- " with st.spinner(\"Classifying accent...\"):\n",
2000
- " accent_model = EncoderClassifier.from_hparams(\n",
2001
- " source=\"speechbrain/lang-id-commonlanguage_ecapa\",\n",
2002
- " savedir=\"tmp_accent_model\"\n",
2003
- " )\n",
2004
- " signal, fs = torchaudio.load(\"audio.wav\")\n",
2005
- " if signal.shape[0] > 1:\n",
2006
- " signal = signal[0].unsqueeze(0)\n",
2007
- " prediction = accent_model.classify_batch(signal)\n",
2008
- " pred_label = prediction[3][0]\n",
2009
- " pred_scores = prediction[1][0]\n",
2010
- " confidence = float(pred_scores.max()) * 100\n",
2011
- " st.success(f\"Predicted Accent: {pred_label} ({confidence:.1f}%)\")\n",
2012
- " st.info(f\"The model is {confidence:.0f}% confident this is a {pred_label} English accent.\")\n",
2013
- "''')\n",
2014
- "\n",
2015
- "print(\"Streamlit app code saved as app.py!\")\n",
2016
- "print(\"To launch the UI, run: !streamlit run app.py --server.headless true --server.port 8501\")\n"
2017
- ],
2018
- "metadata": {
2019
- "colab": {
2020
- "base_uri": "https://localhost:8080/"
2021
- },
2022
- "id": "K7TCPSn8MLcN",
2023
- "outputId": "5c4d3e3a-191e-4b61-97e0-739626eb6263"
2024
- },
2025
- "execution_count": 15,
2026
- "outputs": [
2027
- {
2028
- "output_type": "stream",
2029
- "name": "stdout",
2030
- "text": [
2031
- "Streamlit app code saved as app.py!\n",
2032
- "To launch the UI, run: !streamlit run app.py --server.headless true --server.port 8501\n"
2033
- ]
2034
- }
2035
- ]
2036
- }
2037
- ]
2038
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
accent.py DELETED
@@ -1,180 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
- """Accent.ipynb
3
-
4
- Automatically generated by Colab.
5
-
6
- Original file is located at
7
- https://colab.research.google.com/drive/1yprWdRUXGqD4QIFAZuMwdyTuwA2Hhdvj
8
- """
9
-
10
- # Install needed libraries (run this cell first!)
11
- !pip install --quiet yt-dlp ffmpeg-python torch torchaudio transformers streamlit speechbrain
12
-
13
- import os
14
- import subprocess
15
- import torchaudio
16
- import torch
17
- from speechbrain.pretrained import EncoderClassifier
18
- import yt_dlp
19
-
20
- # Paste your video URL here (YouTube or direct MP4 link)
21
- VIDEO_URL = "https://youtu.be/DDjWTWHHkpk?si=oIj6Fuy8Hg2E8U_l" # Example: Replace with your actual link!
22
-
23
- def download_video(url, out_path="input_video.mp4"):
24
- """
25
- Downloads a video from YouTube or direct MP4 link.
26
- Returns the filename of the downloaded video.
27
- """
28
- # If it's a YouTube link, use yt-dlp
29
- if "youtube.com" in url or "youtu.be" in url:
30
- ydl_opts = {'outtmpl': out_path}
31
- with yt_dlp.YoutubeDL(ydl_opts) as ydl:
32
- ydl.download([url])
33
- else:
34
- # For direct links, use wget/curl fallback
35
- os.system(f"wget -O {out_path} {url}")
36
- return out_path
37
-
38
- video_file = download_video(VIDEO_URL)
39
- print(f"Downloaded video: {video_file}")
40
-
41
- def extract_audio(video_path, audio_path="audio.wav"):
42
- """
43
- Extracts audio from a video file using ffmpeg.
44
- Returns the filename of the audio file.
45
- """
46
- # Remove if already exists
47
- if os.path.exists(audio_path):
48
- os.remove(audio_path)
49
- # Extract audio with ffmpeg
50
- cmd = f"ffmpeg -y -i {video_path} -ar 16000 -ac 1 -vn {audio_path}"
51
- subprocess.call(cmd, shell=True)
52
- return audio_path
53
-
54
- audio_file = extract_audio(video_file)
55
- print(f"Extracted audio file: {audio_file}")
56
-
57
- def extract_audio(video_path, audio_path="/content/audio.wav"):
58
- """
59
- Extracts audio from a video file using ffmpeg.
60
- Returns the filename of the audio file.
61
- """
62
- # Remove if already exists
63
- if os.path.exists(audio_path):
64
- os.remove(audio_path)
65
- # Extract audio with ffmpeg
66
- cmd = f"ffmpeg -y -i {video_path} -ar 16000 -ac 1 -vn {audio_path}"
67
- # Use subprocess.run to capture output and check the return code
68
- result = subprocess.run(cmd, shell=True, capture_output=True, text=True)
69
-
70
- if result.returncode != 0:
71
- print(f"FFmpeg command failed with error code {result.returncode}")
72
- print("FFmpeg stderr:")
73
- print(result.stderr)
74
- # Optionally, raise an error or exit if audio extraction fails
75
- raise RuntimeError(f"Failed to extract audio using FFmpeg. See stderr above.")
76
- else:
77
- print("FFmpeg stdout:")
78
- print(result.stdout)
79
- print("FFmpeg stderr:")
80
- print(result.stderr) # ffmpeg often outputs info/warnings to stderr
81
-
82
- # Check if the audio file was actually created
83
- if not os.path.exists(audio_path):
84
- raise FileNotFoundError(f"Audio file '{audio_path}' was not created after FFmpeg execution.")
85
-
86
- return audio_path
87
-
88
- # Download the pre-trained English accent classifier (SpeechBrain)
89
- accent_model = EncoderClassifier.from_hparams(
90
- source="speechbrain/lang-id-commonlanguage_ecapa",
91
- savedir="tmp_accent_model"
92
- )
93
-
94
- """Used to Debuging the code"""
95
-
96
- # List the files to see if input_video.mp4 is present
97
- import os
98
- print(os.listdir('.'))
99
-
100
- """TO check the debug file path"""
101
-
102
- # Try extracting audio again, but print output to check for errors
103
- video_path = "/content/input_video.mp4.webm" # or whatever your filename is!
104
- audio_path = "audio.wav"
105
-
106
- os.system(f"ffmpeg -y -i {video_path} -ar 16000 -ac 1 -vn {audio_path}")
107
-
108
- # See if audio.wav was created
109
- print(os.listdir('.'))
110
-
111
- """Check the Size of the file"""
112
-
113
- # Check if the file now exists and get its size
114
- import os
115
- print("audio.wav exists:", os.path.exists(audio_path))
116
- if os.path.exists(audio_path):
117
- print("audio.wav size (bytes):", os.path.getsize(audio_path))
118
-
119
- # Load the audio file (must be 16kHz mono)
120
- signal, fs = torchaudio.load(audio_file)
121
-
122
- # If stereo, take only the first channel
123
- if signal.shape[0] > 1:
124
- signal = signal[0].unsqueeze(0)
125
-
126
- # Run classification
127
- prediction = accent_model.classify_batch(signal)
128
- pred_label = prediction[3][0]
129
- pred_scores = prediction[1][0]
130
-
131
- # Convert score to percentage
132
- confidence = float(pred_scores.max()) * 100
133
-
134
- # Display top label and score
135
- print(f"Predicted Accent: {pred_label}")
136
- print(f"Confidence: {confidence:.1f}%")
137
- print("Possible accent labels:", accent_model.hparams.label_encoder.lab2ind.keys())
138
-
139
- explanation = f"The speaker's English accent was classified as '{pred_label}' with a confidence score of {confidence:.1f}%. This means the model is {confidence:.0f}% sure the person sounds most similar to this accent group."
140
-
141
- print(explanation)
142
-
143
- # Save as app.py in Colab for launching a simple web UI
144
- with open("app.py", "w") as f:
145
- f.write('''
146
- import streamlit as st
147
- import os
148
- import subprocess
149
- import torchaudio
150
- from speechbrain.pretrained import EncoderClassifier
151
-
152
- st.title("🗣️ English Accent Classifier (Proof of Concept)")
153
-
154
- url = st.text_input("Enter public video URL (YouTube or direct MP4):")
155
- if st.button("Analyze"):
156
- with st.spinner("Downloading video..."):
157
- if "youtube.com" in url or "youtu.be" in url:
158
- os.system(f'yt-dlp -o input_video.mp4 "{url}"')
159
- else:
160
- os.system(f'wget -O input_video.mp4 "{url}"')
161
- with st.spinner("Extracting audio..."):
162
- os.system("ffmpeg -y -i input_video.mp4 -ar 16000 -ac 1 -vn audio.wav")
163
- with st.spinner("Classifying accent..."):
164
- accent_model = EncoderClassifier.from_hparams(
165
- source="speechbrain/lang-id-commonlanguage_ecapa",
166
- savedir="tmp_accent_model"
167
- )
168
- signal, fs = torchaudio.load("audio.wav")
169
- if signal.shape[0] > 1:
170
- signal = signal[0].unsqueeze(0)
171
- prediction = accent_model.classify_batch(signal)
172
- pred_label = prediction[3][0]
173
- pred_scores = prediction[1][0]
174
- confidence = float(pred_scores.max()) * 100
175
- st.success(f"Predicted Accent: {pred_label} ({confidence:.1f}%)")
176
- st.info(f"The model is {confidence:.0f}% confident this is a {pred_label} English accent.")
177
- ''')
178
-
179
- print("Streamlit app code saved as app.py!")
180
- print("To launch the UI, run: !streamlit run app.py --server.headless true --server.port 8501")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app.py DELETED
@@ -1,65 +0,0 @@
1
- import gradio as gr
2
- import os
3
- import torchaudio
4
- from speechbrain.pretrained import EncoderClassifier
5
-
6
- def accent_detect(video_link, video_file):
7
- # Decide which input to use
8
- video_path = None
9
-
10
- # If a video file is uploaded, use it
11
- if video_file is not None:
12
- video_path = "uploaded_input.mp4"
13
- with open(video_path, "wb") as f:
14
- f.write(video_file.read())
15
- # Else if a link is provided, try to download it
16
- elif video_link and len(video_link.strip()) > 8:
17
- # Use yt-dlp for YouTube or wget for direct link
18
- if "youtube.com" in video_link or "youtu.be" in video_link:
19
- os.system(f'yt-dlp -o input_video.mp4 "{video_link}"')
20
- else:
21
- os.system(f'wget -O input_video.mp4 "{video_link}"')
22
- if os.path.exists("input_video.mp4") and os.path.getsize("input_video.mp4") > 0:
23
- video_path = "input_video.mp4"
24
- else:
25
- return "Failed to download the video. Please check your link."
26
- else:
27
- return "Please upload a video file or provide a valid video link."
28
-
29
- # Extract audio from video
30
- os.system(f"ffmpeg -y -i '{video_path}' -ar 16000 -ac 1 -vn audio.wav")
31
-
32
- if not os.path.exists("audio.wav") or os.path.getsize("audio.wav") < 1000:
33
- return "Audio extraction failed. Please use a different video."
34
-
35
- # Load model and classify accent
36
- accent_model = EncoderClassifier.from_hparams(
37
- source="speechbrain/lang-id-commonlanguage_ecapa",
38
- savedir="tmp_accent_model"
39
- )
40
- signal, fs = torchaudio.load("audio.wav")
41
- if signal.shape[0] > 1:
42
- signal = signal[0].unsqueeze(0)
43
- prediction = accent_model.classify_batch(signal)
44
- pred_label = prediction[3][0]
45
- pred_scores = prediction[1][0]
46
- confidence = float(pred_scores.max()) * 100
47
- explanation = (
48
- f"Predicted Accent: {pred_label} ({confidence:.1f}%)\n"
49
- f"The model is {confidence:.0f}% confident this is a {pred_label} English accent."
50
- )
51
- return explanation
52
-
53
- demo = gr.Interface(
54
- fn=accent_detect,
55
- inputs=[
56
- gr.Textbox(label="YouTube or direct MP4 link (optional)", placeholder="https://youtube.com/yourvideo"),
57
- gr.File(label="Or upload a video file (MP4, WEBM, etc.)"),
58
- ],
59
- outputs="text",
60
- title="🗣️ English Accent Classifier (Gradio Demo)",
61
- description="Paste a YouTube/direct MP4 link or upload a video file with English speech. The tool predicts the English accent and confidence."
62
- )
63
-
64
- if __name__ == "__main__":
65
- demo.launch()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
packages.txt DELETED
@@ -1,2 +0,0 @@
1
- ffmpeg
2
- sox
 
 
 
requirements.txt DELETED
@@ -1,7 +0,0 @@
1
- numpy<2
2
- torch==2.1.2
3
- torchaudio==2.1.2
4
- ffmpeg-python
5
- yt-dlp
6
- gradio
7
- speechbrain