File size: 79,486 Bytes
af0c0e2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
694ec5c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
d6f7b0e
694ec5c
 
 
d359a51
694ec5c
 
d359a51
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
694ec5c
d359a51
 
 
 
 
 
 
 
 
 
 
694ec5c
d359a51
 
 
 
 
 
 
 
 
 
 
 
 
d6f7b0e
 
 
 
d359a51
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
d6f7b0e
d359a51
 
 
 
 
 
 
 
 
 
 
d6f7b0e
 
 
 
d359a51
d6f7b0e
 
 
 
694ec5c
 
d359a51
d6f7b0e
694ec5c
 
 
 
d359a51
694ec5c
af0c0e2
 
 
 
d6f7b0e
af0c0e2
 
 
 
 
 
 
 
 
 
 
 
 
d6f7b0e
af0c0e2
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Disease</th>\n",
       "      <th>Fever</th>\n",
       "      <th>Cough</th>\n",
       "      <th>Fatigue</th>\n",
       "      <th>Difficulty Breathing</th>\n",
       "      <th>Age</th>\n",
       "      <th>Gender</th>\n",
       "      <th>Blood Pressure</th>\n",
       "      <th>Cholesterol Level</th>\n",
       "      <th>Outcome Variable</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>Influenza</td>\n",
       "      <td>Yes</td>\n",
       "      <td>No</td>\n",
       "      <td>Yes</td>\n",
       "      <td>Yes</td>\n",
       "      <td>19</td>\n",
       "      <td>Female</td>\n",
       "      <td>Low</td>\n",
       "      <td>Normal</td>\n",
       "      <td>Positive</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>Common Cold</td>\n",
       "      <td>No</td>\n",
       "      <td>Yes</td>\n",
       "      <td>Yes</td>\n",
       "      <td>No</td>\n",
       "      <td>25</td>\n",
       "      <td>Female</td>\n",
       "      <td>Normal</td>\n",
       "      <td>Normal</td>\n",
       "      <td>Negative</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>Eczema</td>\n",
       "      <td>No</td>\n",
       "      <td>Yes</td>\n",
       "      <td>Yes</td>\n",
       "      <td>No</td>\n",
       "      <td>25</td>\n",
       "      <td>Female</td>\n",
       "      <td>Normal</td>\n",
       "      <td>Normal</td>\n",
       "      <td>Negative</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>Asthma</td>\n",
       "      <td>Yes</td>\n",
       "      <td>Yes</td>\n",
       "      <td>No</td>\n",
       "      <td>Yes</td>\n",
       "      <td>25</td>\n",
       "      <td>Male</td>\n",
       "      <td>Normal</td>\n",
       "      <td>Normal</td>\n",
       "      <td>Positive</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>Asthma</td>\n",
       "      <td>Yes</td>\n",
       "      <td>Yes</td>\n",
       "      <td>No</td>\n",
       "      <td>Yes</td>\n",
       "      <td>25</td>\n",
       "      <td>Male</td>\n",
       "      <td>Normal</td>\n",
       "      <td>Normal</td>\n",
       "      <td>Positive</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "       Disease Fever Cough Fatigue Difficulty Breathing  Age  Gender  \\\n",
       "0    Influenza   Yes    No     Yes                  Yes   19  Female   \n",
       "1  Common Cold    No   Yes     Yes                   No   25  Female   \n",
       "2       Eczema    No   Yes     Yes                   No   25  Female   \n",
       "3       Asthma   Yes   Yes      No                  Yes   25    Male   \n",
       "4       Asthma   Yes   Yes      No                  Yes   25    Male   \n",
       "\n",
       "  Blood Pressure Cholesterol Level Outcome Variable  \n",
       "0            Low            Normal         Positive  \n",
       "1         Normal            Normal         Negative  \n",
       "2         Normal            Normal         Negative  \n",
       "3         Normal            Normal         Positive  \n",
       "4         Normal            Normal         Positive  "
      ]
     },
     "execution_count": 1,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# Loading dataset disease and symptoms dataset\n",
    "import pandas as pd\n",
    "\n",
    "data = pd.read_csv(\"../artifacts/Disease_symptom_and_patient_profile_dataset.csv\")\n",
    "diseases = data.copy()\n",
    "data.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(349, 10)"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# Data size\n",
    "data.shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "<class 'pandas.core.frame.DataFrame'>\n",
      "RangeIndex: 349 entries, 0 to 348\n",
      "Data columns (total 10 columns):\n",
      " #   Column                Non-Null Count  Dtype \n",
      "---  ------                --------------  ----- \n",
      " 0   Disease               349 non-null    object\n",
      " 1   Fever                 349 non-null    object\n",
      " 2   Cough                 349 non-null    object\n",
      " 3   Fatigue               349 non-null    object\n",
      " 4   Difficulty Breathing  349 non-null    object\n",
      " 5   Age                   349 non-null    int64 \n",
      " 6   Gender                349 non-null    object\n",
      " 7   Blood Pressure        349 non-null    object\n",
      " 8   Cholesterol Level     349 non-null    object\n",
      " 9   Outcome Variable      349 non-null    object\n",
      "dtypes: int64(1), object(9)\n",
      "memory usage: 27.4+ KB\n"
     ]
    }
   ],
   "source": [
    "# Info about dataset\n",
    "data.info()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Disease                 0\n",
       "Fever                   0\n",
       "Cough                   0\n",
       "Fatigue                 0\n",
       "Difficulty Breathing    0\n",
       "Age                     0\n",
       "Gender                  0\n",
       "Blood Pressure          0\n",
       "Cholesterol Level       0\n",
       "Outcome Variable        0\n",
       "dtype: int64"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# Exploratory data analysis\n",
    "# Null values in the dataset\n",
    "data.isnull().sum()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "49"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# Duplicate entries\n",
    "data.duplicated().sum()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# Remove duplicates\n",
    "data.drop_duplicates(inplace=True)\n",
    "data.duplicated().sum()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Disease\n",
       "Asthma                            16\n",
       "Osteoporosis                      12\n",
       "Stroke                            11\n",
       "Hypertension                      10\n",
       "Migraine                          10\n",
       "                                  ..\n",
       "Fibromyalgia                       1\n",
       "Eating Disorders (Anorexia,...     1\n",
       "Chickenpox                         1\n",
       "Rabies                             1\n",
       "Williams Syndrome                  1\n",
       "Name: count, Length: 116, dtype: int64"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# Nos of dieseases\n",
    "data['Disease'].value_counts()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "count    300.000000\n",
       "mean      45.756667\n",
       "std       12.596548\n",
       "min       19.000000\n",
       "25%       35.000000\n",
       "50%       45.000000\n",
       "75%       55.000000\n",
       "max       90.000000\n",
       "Name: Age, dtype: float64"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# Age range\n",
    "data['Age'].describe()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [],
   "source": [
    "# Numerical columns ie Age column categorization\n",
    "# Categories : Less than 40 - Young, 40-60 - Mid, and above 60 aged\n",
    "def age_category(age):\n",
    "    if age < 40:\n",
    "        return 'young'\n",
    "    elif age < 60:\n",
    "        return 'Middle'\n",
    "    elif age >= 60:\n",
    "        return 'Old'\n",
    "    \n",
    "data['Age'] = data['Age'].apply(lambda x: age_category(x))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Disease</th>\n",
       "      <th>Fever</th>\n",
       "      <th>Cough</th>\n",
       "      <th>Fatigue</th>\n",
       "      <th>Difficulty Breathing</th>\n",
       "      <th>Age</th>\n",
       "      <th>Gender</th>\n",
       "      <th>Blood Pressure</th>\n",
       "      <th>Cholesterol Level</th>\n",
       "      <th>Outcome Variable</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>Influenza</td>\n",
       "      <td>Yes</td>\n",
       "      <td>No</td>\n",
       "      <td>Yes</td>\n",
       "      <td>Yes</td>\n",
       "      <td>young</td>\n",
       "      <td>Female</td>\n",
       "      <td>Low</td>\n",
       "      <td>Normal</td>\n",
       "      <td>Positive</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>Common Cold</td>\n",
       "      <td>No</td>\n",
       "      <td>Yes</td>\n",
       "      <td>Yes</td>\n",
       "      <td>No</td>\n",
       "      <td>young</td>\n",
       "      <td>Female</td>\n",
       "      <td>Normal</td>\n",
       "      <td>Normal</td>\n",
       "      <td>Negative</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>Eczema</td>\n",
       "      <td>No</td>\n",
       "      <td>Yes</td>\n",
       "      <td>Yes</td>\n",
       "      <td>No</td>\n",
       "      <td>young</td>\n",
       "      <td>Female</td>\n",
       "      <td>Normal</td>\n",
       "      <td>Normal</td>\n",
       "      <td>Negative</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>Asthma</td>\n",
       "      <td>Yes</td>\n",
       "      <td>Yes</td>\n",
       "      <td>No</td>\n",
       "      <td>Yes</td>\n",
       "      <td>young</td>\n",
       "      <td>Male</td>\n",
       "      <td>Normal</td>\n",
       "      <td>Normal</td>\n",
       "      <td>Positive</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>Eczema</td>\n",
       "      <td>Yes</td>\n",
       "      <td>No</td>\n",
       "      <td>No</td>\n",
       "      <td>No</td>\n",
       "      <td>young</td>\n",
       "      <td>Female</td>\n",
       "      <td>Normal</td>\n",
       "      <td>Normal</td>\n",
       "      <td>Positive</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "       Disease Fever Cough Fatigue Difficulty Breathing    Age  Gender  \\\n",
       "0    Influenza   Yes    No     Yes                  Yes  young  Female   \n",
       "1  Common Cold    No   Yes     Yes                   No  young  Female   \n",
       "2       Eczema    No   Yes     Yes                   No  young  Female   \n",
       "3       Asthma   Yes   Yes      No                  Yes  young    Male   \n",
       "5       Eczema   Yes    No      No                   No  young  Female   \n",
       "\n",
       "  Blood Pressure Cholesterol Level Outcome Variable  \n",
       "0            Low            Normal         Positive  \n",
       "1         Normal            Normal         Negative  \n",
       "2         Normal            Normal         Negative  \n",
       "3         Normal            Normal         Positive  \n",
       "5         Normal            Normal         Positive  "
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [],
   "source": [
    "# Categorical columns encoding\n",
    "from sklearn.preprocessing import LabelEncoder\n",
    "\n",
    "le = LabelEncoder()\n",
    "data['Fever'] = le.fit_transform(data['Fever'])\n",
    "data['Cough'] = le.fit_transform(data['Cough'])\n",
    "data['Fatigue'] = le.fit_transform(data['Fatigue'])\n",
    "data['Difficulty Breathing'] = le.fit_transform(data['Difficulty Breathing'])\n",
    "data['Age'] = le.fit_transform(data['Age'])\n",
    "data['Gender'] = le.fit_transform(data['Gender'])\n",
    "data['Blood Pressure'] = le.fit_transform(data['Blood Pressure'])\n",
    "data['Cholesterol Level'] = le.fit_transform(data['Cholesterol Level'])\n",
    "data['Outcome Variable'] = le.fit_transform(data['Outcome Variable'])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Disease</th>\n",
       "      <th>Fever</th>\n",
       "      <th>Cough</th>\n",
       "      <th>Fatigue</th>\n",
       "      <th>Difficulty Breathing</th>\n",
       "      <th>Age</th>\n",
       "      <th>Gender</th>\n",
       "      <th>Blood Pressure</th>\n",
       "      <th>Cholesterol Level</th>\n",
       "      <th>Outcome Variable</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>Influenza</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>2</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>2</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>Common Cold</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>2</td>\n",
       "      <td>0</td>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>Eczema</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>2</td>\n",
       "      <td>0</td>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>Asthma</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>2</td>\n",
       "      <td>1</td>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>Eczema</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>2</td>\n",
       "      <td>0</td>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "       Disease  Fever  Cough  Fatigue  Difficulty Breathing  Age  Gender  \\\n",
       "0    Influenza      1      0        1                     1    2       0   \n",
       "1  Common Cold      0      1        1                     0    2       0   \n",
       "2       Eczema      0      1        1                     0    2       0   \n",
       "3       Asthma      1      1        0                     1    2       1   \n",
       "5       Eczema      1      0        0                     0    2       0   \n",
       "\n",
       "   Blood Pressure  Cholesterol Level  Outcome Variable  \n",
       "0               1                  2                 1  \n",
       "1               2                  2                 0  \n",
       "2               2                  2                 0  \n",
       "3               2                  2                 1  \n",
       "5               2                  2                 1  "
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# Labelled data\n",
    "data.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [],
   "source": [
    "# Features selection\n",
    "# Predictor variables\n",
    "X = data.drop(['Disease', 'Outcome Variable'], axis=1)\n",
    "\n",
    "# Target variable\n",
    "y = data['Outcome Variable']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [],
   "source": [
    "# Splitting of dataset\n",
    "from sklearn.model_selection import train_test_split\n",
    "\n",
    "X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "((240, 8), (60, 8))"
      ]
     },
     "execution_count": 15,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# Split size verification\n",
    "X_train.shape, X_test.shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {},
   "outputs": [],
   "source": [
    "# Model training\n",
    "from sklearn.linear_model import LogisticRegression\n",
    "\n",
    "logit_model = LogisticRegression()\n",
    "logit_model = logit_model.fit(X_train,y_train)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0.75"
      ]
     },
     "execution_count": 17,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# Model evaluation\n",
    "logit_model.score(X_test,y_test)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {},
   "outputs": [],
   "source": [
    "# Catboost model\n",
    "from catboost import CatBoostClassifier\n",
    "\n",
    "cat_model = CatBoostClassifier(verbose=False)\n",
    "cat_model = cat_model.fit(X_train,y_train)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0.7333333333333333"
      ]
     },
     "execution_count": 19,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# Model evaluation\n",
    "cat_model.score(X_test,y_test)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {},
   "outputs": [],
   "source": [
    "# Logistic regresson model has better performance\n",
    "import pickle\n",
    "\n",
    "with open(\"Logit_model.pkl\", 'wb') as file:\n",
    "    pickle.dump(logit_model, file)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "c:\\Users\\umesh\\anaconda3\\envs\\GenAI\\Lib\\site-packages\\pydub\\utils.py:170: RuntimeWarning: Couldn't find ffmpeg or avconv - defaulting to ffmpeg, but may not work\n",
      "  warn(\"Couldn't find ffmpeg or avconv - defaulting to ffmpeg, but may not work\", RuntimeWarning)\n",
      "c:\\Users\\umesh\\anaconda3\\envs\\GenAI\\Lib\\site-packages\\pydub\\utils.py:198: RuntimeWarning: Couldn't find ffprobe or avprobe - defaulting to ffprobe, but may not work\n",
      "  warn(\"Couldn't find ffprobe or avprobe - defaulting to ffprobe, but may not work\", RuntimeWarning)\n"
     ]
    },
    {
     "ename": "FileNotFoundError",
     "evalue": "[WinError 2] The system cannot find the file specified",
     "output_type": "error",
     "traceback": [
      "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[1;31mFileNotFoundError\u001b[0m                         Traceback (most recent call last)",
      "Cell \u001b[1;32mIn[1], line 9\u001b[0m\n\u001b[0;32m      6\u001b[0m langs\u001b[38;5;241m=\u001b[39mtts_langs()\u001b[38;5;241m.\u001b[39mkeys()\n\u001b[0;32m      8\u001b[0m \u001b[38;5;66;03m#get the audio first\u001b[39;00m\n\u001b[1;32m----> 9\u001b[0m audio\u001b[38;5;241m=\u001b[39mtext_to_audio(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mChoose a language, type some text, and click \u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mSpeak it out!\u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;124m.\u001b[39m\u001b[38;5;124m\"\u001b[39m,language\u001b[38;5;241m=\u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;124men\u001b[39m\u001b[38;5;124m'\u001b[39m)\n\u001b[0;32m     10\u001b[0m \u001b[38;5;66;03m#then play it\u001b[39;00m\n\u001b[0;32m     11\u001b[0m auto_play(audio)\n",
      "File \u001b[1;32mc:\\Users\\umesh\\anaconda3\\envs\\GenAI\\Lib\\site-packages\\streamlit_TTS\\__init__.py:72\u001b[0m, in \u001b[0;36mtext_to_audio\u001b[1;34m(text, language, cleanup_hook)\u001b[0m\n\u001b[0;32m     69\u001b[0m mp3_buffer\u001b[38;5;241m.\u001b[39mseek(\u001b[38;5;241m0\u001b[39m)\n\u001b[0;32m     71\u001b[0m \u001b[38;5;66;03m# Convert MP3 to WAV and make it mono\u001b[39;00m\n\u001b[1;32m---> 72\u001b[0m audio \u001b[38;5;241m=\u001b[39m AudioSegment\u001b[38;5;241m.\u001b[39mfrom_file(mp3_buffer,\u001b[38;5;28mformat\u001b[39m\u001b[38;5;241m=\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mmp3\u001b[39m\u001b[38;5;124m\"\u001b[39m)\u001b[38;5;241m.\u001b[39mset_channels(\u001b[38;5;241m1\u001b[39m)\n\u001b[0;32m     74\u001b[0m \u001b[38;5;66;03m# Extract audio properties\u001b[39;00m\n\u001b[0;32m     75\u001b[0m sample_rate \u001b[38;5;241m=\u001b[39m audio\u001b[38;5;241m.\u001b[39mframe_rate\n",
      "File \u001b[1;32mc:\\Users\\umesh\\anaconda3\\envs\\GenAI\\Lib\\site-packages\\pydub\\audio_segment.py:728\u001b[0m, in \u001b[0;36mAudioSegment.from_file\u001b[1;34m(cls, file, format, codec, parameters, start_second, duration, **kwargs)\u001b[0m\n\u001b[0;32m    726\u001b[0m     info \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mNone\u001b[39;00m\n\u001b[0;32m    727\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m--> 728\u001b[0m     info \u001b[38;5;241m=\u001b[39m mediainfo_json(orig_file, read_ahead_limit\u001b[38;5;241m=\u001b[39mread_ahead_limit)\n\u001b[0;32m    729\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m info:\n\u001b[0;32m    730\u001b[0m     audio_streams \u001b[38;5;241m=\u001b[39m [x \u001b[38;5;28;01mfor\u001b[39;00m x \u001b[38;5;129;01min\u001b[39;00m info[\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mstreams\u001b[39m\u001b[38;5;124m'\u001b[39m]\n\u001b[0;32m    731\u001b[0m                      \u001b[38;5;28;01mif\u001b[39;00m x[\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mcodec_type\u001b[39m\u001b[38;5;124m'\u001b[39m] \u001b[38;5;241m==\u001b[39m \u001b[38;5;124m'\u001b[39m\u001b[38;5;124maudio\u001b[39m\u001b[38;5;124m'\u001b[39m]\n",
      "File \u001b[1;32mc:\\Users\\umesh\\anaconda3\\envs\\GenAI\\Lib\\site-packages\\pydub\\utils.py:274\u001b[0m, in \u001b[0;36mmediainfo_json\u001b[1;34m(filepath, read_ahead_limit)\u001b[0m\n\u001b[0;32m    271\u001b[0m         file\u001b[38;5;241m.\u001b[39mclose()\n\u001b[0;32m    273\u001b[0m command \u001b[38;5;241m=\u001b[39m [prober, \u001b[38;5;124m'\u001b[39m\u001b[38;5;124m-of\u001b[39m\u001b[38;5;124m'\u001b[39m, \u001b[38;5;124m'\u001b[39m\u001b[38;5;124mjson\u001b[39m\u001b[38;5;124m'\u001b[39m] \u001b[38;5;241m+\u001b[39m command_args\n\u001b[1;32m--> 274\u001b[0m res \u001b[38;5;241m=\u001b[39m Popen(command, stdin\u001b[38;5;241m=\u001b[39mstdin_parameter, stdout\u001b[38;5;241m=\u001b[39mPIPE, stderr\u001b[38;5;241m=\u001b[39mPIPE)\n\u001b[0;32m    275\u001b[0m output, stderr \u001b[38;5;241m=\u001b[39m res\u001b[38;5;241m.\u001b[39mcommunicate(\u001b[38;5;28minput\u001b[39m\u001b[38;5;241m=\u001b[39mstdin_data)\n\u001b[0;32m    276\u001b[0m output \u001b[38;5;241m=\u001b[39m output\u001b[38;5;241m.\u001b[39mdecode(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mutf-8\u001b[39m\u001b[38;5;124m\"\u001b[39m, \u001b[38;5;124m'\u001b[39m\u001b[38;5;124mignore\u001b[39m\u001b[38;5;124m'\u001b[39m)\n",
      "File \u001b[1;32mc:\\Users\\umesh\\anaconda3\\envs\\GenAI\\Lib\\subprocess.py:1026\u001b[0m, in \u001b[0;36mPopen.__init__\u001b[1;34m(self, args, bufsize, executable, stdin, stdout, stderr, preexec_fn, close_fds, shell, cwd, env, universal_newlines, startupinfo, creationflags, restore_signals, start_new_session, pass_fds, user, group, extra_groups, encoding, errors, text, umask, pipesize, process_group)\u001b[0m\n\u001b[0;32m   1022\u001b[0m         \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mtext_mode:\n\u001b[0;32m   1023\u001b[0m             \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mstderr \u001b[38;5;241m=\u001b[39m io\u001b[38;5;241m.\u001b[39mTextIOWrapper(\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mstderr,\n\u001b[0;32m   1024\u001b[0m                     encoding\u001b[38;5;241m=\u001b[39mencoding, errors\u001b[38;5;241m=\u001b[39merrors)\n\u001b[1;32m-> 1026\u001b[0m     \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_execute_child(args, executable, preexec_fn, close_fds,\n\u001b[0;32m   1027\u001b[0m                         pass_fds, cwd, env,\n\u001b[0;32m   1028\u001b[0m                         startupinfo, creationflags, shell,\n\u001b[0;32m   1029\u001b[0m                         p2cread, p2cwrite,\n\u001b[0;32m   1030\u001b[0m                         c2pread, c2pwrite,\n\u001b[0;32m   1031\u001b[0m                         errread, errwrite,\n\u001b[0;32m   1032\u001b[0m                         restore_signals,\n\u001b[0;32m   1033\u001b[0m                         gid, gids, uid, umask,\n\u001b[0;32m   1034\u001b[0m                         start_new_session, process_group)\n\u001b[0;32m   1035\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m:\n\u001b[0;32m   1036\u001b[0m     \u001b[38;5;66;03m# Cleanup if the child failed starting.\u001b[39;00m\n\u001b[0;32m   1037\u001b[0m     \u001b[38;5;28;01mfor\u001b[39;00m f \u001b[38;5;129;01min\u001b[39;00m \u001b[38;5;28mfilter\u001b[39m(\u001b[38;5;28;01mNone\u001b[39;00m, (\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mstdin, \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mstdout, \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mstderr)):\n",
      "File \u001b[1;32mc:\\Users\\umesh\\anaconda3\\envs\\GenAI\\Lib\\subprocess.py:1538\u001b[0m, in \u001b[0;36mPopen._execute_child\u001b[1;34m(self, args, executable, preexec_fn, close_fds, pass_fds, cwd, env, startupinfo, creationflags, shell, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite, unused_restore_signals, unused_gid, unused_gids, unused_uid, unused_umask, unused_start_new_session, unused_process_group)\u001b[0m\n\u001b[0;32m   1536\u001b[0m \u001b[38;5;66;03m# Start the process\u001b[39;00m\n\u001b[0;32m   1537\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[1;32m-> 1538\u001b[0m     hp, ht, pid, tid \u001b[38;5;241m=\u001b[39m _winapi\u001b[38;5;241m.\u001b[39mCreateProcess(executable, args,\n\u001b[0;32m   1539\u001b[0m                              \u001b[38;5;66;03m# no special security\u001b[39;00m\n\u001b[0;32m   1540\u001b[0m                              \u001b[38;5;28;01mNone\u001b[39;00m, \u001b[38;5;28;01mNone\u001b[39;00m,\n\u001b[0;32m   1541\u001b[0m                              \u001b[38;5;28mint\u001b[39m(\u001b[38;5;129;01mnot\u001b[39;00m close_fds),\n\u001b[0;32m   1542\u001b[0m                              creationflags,\n\u001b[0;32m   1543\u001b[0m                              env,\n\u001b[0;32m   1544\u001b[0m                              cwd,\n\u001b[0;32m   1545\u001b[0m                              startupinfo)\n\u001b[0;32m   1546\u001b[0m \u001b[38;5;28;01mfinally\u001b[39;00m:\n\u001b[0;32m   1547\u001b[0m     \u001b[38;5;66;03m# Child is launched. Close the parent's copy of those pipe\u001b[39;00m\n\u001b[0;32m   1548\u001b[0m     \u001b[38;5;66;03m# handles that only the child should have open.  You need\u001b[39;00m\n\u001b[1;32m   (...)\u001b[0m\n\u001b[0;32m   1551\u001b[0m     \u001b[38;5;66;03m# pipe will not close when the child process exits and the\u001b[39;00m\n\u001b[0;32m   1552\u001b[0m     \u001b[38;5;66;03m# ReadFile will hang.\u001b[39;00m\n\u001b[0;32m   1553\u001b[0m     \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_close_pipe_fds(p2cread, p2cwrite,\n\u001b[0;32m   1554\u001b[0m                          c2pread, c2pwrite,\n\u001b[0;32m   1555\u001b[0m                          errread, errwrite)\n",
      "\u001b[1;31mFileNotFoundError\u001b[0m: [WinError 2] The system cannot find the file specified"
     ]
    }
   ],
   "source": [
    "import streamlit as st\n",
    "from streamlit_TTS import auto_play, text_to_speech, text_to_audio\n",
    "\n",
    "from gtts.lang import tts_langs\n",
    "\n",
    "langs=tts_langs().keys()\n",
    "\n",
    "#get the audio first\n",
    "audio=text_to_audio(\"Choose a language, type some text, and click 'Speak it out!'.\", language='en')\n",
    "#then play it\n",
    "auto_play(audio)\n",
    "\n",
    "lang=st.selectbox(\"Choose a language\",options=langs)\n",
    "text=st.text_input(\"Choose a text to speak out:\")\n",
    "speak=st.button(\"Speak it out!\")\n",
    "\n",
    "if lang and text and speak:\n",
    "    #plays the audio directly\n",
    "    text_to_speech(text=text, language=lang)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Collecting streamlit-bokeh-events\n",
      "  Downloading streamlit_bokeh_events-0.1.2-py3-none-any.whl.metadata (407 bytes)\n",
      "Requirement already satisfied: bokeh>=2.0.0 in c:\\users\\umesh\\anaconda3\\envs\\deeplearning\\lib\\site-packages (from streamlit-bokeh-events) (3.6.0)\n",
      "Requirement already satisfied: streamlit>=0.63 in c:\\users\\umesh\\anaconda3\\envs\\deeplearning\\lib\\site-packages (from streamlit-bokeh-events) (1.39.0)\n",
      "Requirement already satisfied: Jinja2>=2.9 in c:\\users\\umesh\\anaconda3\\envs\\deeplearning\\lib\\site-packages (from bokeh>=2.0.0->streamlit-bokeh-events) (3.1.2)\n",
      "Requirement already satisfied: contourpy>=1.2 in c:\\users\\umesh\\anaconda3\\envs\\deeplearning\\lib\\site-packages (from bokeh>=2.0.0->streamlit-bokeh-events) (1.3.0)\n",
      "Requirement already satisfied: numpy>=1.16 in c:\\users\\umesh\\appdata\\roaming\\python\\python310\\site-packages (from bokeh>=2.0.0->streamlit-bokeh-events) (1.26.4)\n",
      "Requirement already satisfied: packaging>=16.8 in c:\\users\\umesh\\anaconda3\\envs\\deeplearning\\lib\\site-packages (from bokeh>=2.0.0->streamlit-bokeh-events) (24.1)\n",
      "Requirement already satisfied: pandas>=1.2 in c:\\users\\umesh\\anaconda3\\envs\\deeplearning\\lib\\site-packages (from bokeh>=2.0.0->streamlit-bokeh-events) (2.1.1)\n",
      "Requirement already satisfied: pillow>=7.1.0 in c:\\users\\umesh\\anaconda3\\envs\\deeplearning\\lib\\site-packages (from bokeh>=2.0.0->streamlit-bokeh-events) (9.5.0)\n",
      "Requirement already satisfied: PyYAML>=3.10 in c:\\users\\umesh\\anaconda3\\envs\\deeplearning\\lib\\site-packages (from bokeh>=2.0.0->streamlit-bokeh-events) (6.0.1)\n",
      "Requirement already satisfied: tornado>=6.2 in c:\\users\\umesh\\anaconda3\\envs\\deeplearning\\lib\\site-packages (from bokeh>=2.0.0->streamlit-bokeh-events) (6.3.3)\n",
      "Requirement already satisfied: xyzservices>=2021.09.1 in c:\\users\\umesh\\anaconda3\\envs\\deeplearning\\lib\\site-packages (from bokeh>=2.0.0->streamlit-bokeh-events) (2024.9.0)\n",
      "Requirement already satisfied: altair<6,>=4.0 in c:\\users\\umesh\\anaconda3\\envs\\deeplearning\\lib\\site-packages (from streamlit>=0.63->streamlit-bokeh-events) (5.4.1)\n",
      "Requirement already satisfied: blinker<2,>=1.0.0 in c:\\users\\umesh\\anaconda3\\envs\\deeplearning\\lib\\site-packages (from streamlit>=0.63->streamlit-bokeh-events) (1.6.2)\n",
      "Requirement already satisfied: cachetools<6,>=4.0 in c:\\users\\umesh\\anaconda3\\envs\\deeplearning\\lib\\site-packages (from streamlit>=0.63->streamlit-bokeh-events) (4.2.2)\n",
      "Requirement already satisfied: click<9,>=7.0 in c:\\users\\umesh\\anaconda3\\envs\\deeplearning\\lib\\site-packages (from streamlit>=0.63->streamlit-bokeh-events) (8.1.7)\n",
      "Requirement already satisfied: protobuf<6,>=3.20 in c:\\users\\umesh\\anaconda3\\envs\\deeplearning\\lib\\site-packages (from streamlit>=0.63->streamlit-bokeh-events) (3.20.3)\n",
      "Requirement already satisfied: pyarrow>=7.0 in c:\\users\\umesh\\anaconda3\\envs\\deeplearning\\lib\\site-packages (from streamlit>=0.63->streamlit-bokeh-events) (11.0.0)\n",
      "Requirement already satisfied: requests<3,>=2.27 in c:\\users\\umesh\\anaconda3\\envs\\deeplearning\\lib\\site-packages (from streamlit>=0.63->streamlit-bokeh-events) (2.31.0)\n",
      "Requirement already satisfied: rich<14,>=10.14.0 in c:\\users\\umesh\\anaconda3\\envs\\deeplearning\\lib\\site-packages (from streamlit>=0.63->streamlit-bokeh-events) (13.7.1)\n",
      "Requirement already satisfied: tenacity<10,>=8.1.0 in c:\\users\\umesh\\anaconda3\\envs\\deeplearning\\lib\\site-packages (from streamlit>=0.63->streamlit-bokeh-events) (8.2.2)\n",
      "Requirement already satisfied: toml<2,>=0.10.1 in c:\\users\\umesh\\anaconda3\\envs\\deeplearning\\lib\\site-packages (from streamlit>=0.63->streamlit-bokeh-events) (0.10.2)\n",
      "Requirement already satisfied: typing-extensions<5,>=4.3.0 in c:\\users\\umesh\\anaconda3\\envs\\deeplearning\\lib\\site-packages (from streamlit>=0.63->streamlit-bokeh-events) (4.12.2)\n",
      "Requirement already satisfied: gitpython!=3.1.19,<4,>=3.0.7 in c:\\users\\umesh\\anaconda3\\envs\\deeplearning\\lib\\site-packages (from streamlit>=0.63->streamlit-bokeh-events) (3.1.43)\n",
      "Requirement already satisfied: pydeck<1,>=0.8.0b4 in c:\\users\\umesh\\anaconda3\\envs\\deeplearning\\lib\\site-packages (from streamlit>=0.63->streamlit-bokeh-events) (0.9.1)\n",
      "Requirement already satisfied: watchdog<6,>=2.1.5 in c:\\users\\umesh\\anaconda3\\envs\\deeplearning\\lib\\site-packages (from streamlit>=0.63->streamlit-bokeh-events) (5.0.3)\n",
      "Requirement already satisfied: jsonschema>=3.0 in c:\\users\\umesh\\anaconda3\\envs\\deeplearning\\lib\\site-packages (from altair<6,>=4.0->streamlit>=0.63->streamlit-bokeh-events) (4.19.2)\n",
      "Requirement already satisfied: narwhals>=1.5.2 in c:\\users\\umesh\\anaconda3\\envs\\deeplearning\\lib\\site-packages (from altair<6,>=4.0->streamlit>=0.63->streamlit-bokeh-events) (1.12.1)\n",
      "Requirement already satisfied: colorama in c:\\users\\umesh\\anaconda3\\envs\\deeplearning\\lib\\site-packages (from click<9,>=7.0->streamlit>=0.63->streamlit-bokeh-events) (0.4.6)\n",
      "Requirement already satisfied: gitdb<5,>=4.0.1 in c:\\users\\umesh\\anaconda3\\envs\\deeplearning\\lib\\site-packages (from gitpython!=3.1.19,<4,>=3.0.7->streamlit>=0.63->streamlit-bokeh-events) (4.0.11)\n",
      "Requirement already satisfied: MarkupSafe>=2.0 in c:\\users\\umesh\\anaconda3\\envs\\deeplearning\\lib\\site-packages (from Jinja2>=2.9->bokeh>=2.0.0->streamlit-bokeh-events) (2.1.1)\n",
      "Requirement already satisfied: python-dateutil>=2.8.2 in c:\\users\\umesh\\anaconda3\\envs\\deeplearning\\lib\\site-packages (from pandas>=1.2->bokeh>=2.0.0->streamlit-bokeh-events) (2.8.2)\n",
      "Requirement already satisfied: pytz>=2020.1 in c:\\users\\umesh\\anaconda3\\envs\\deeplearning\\lib\\site-packages (from pandas>=1.2->bokeh>=2.0.0->streamlit-bokeh-events) (2023.3.post1)\n",
      "Requirement already satisfied: tzdata>=2022.1 in c:\\users\\umesh\\anaconda3\\envs\\deeplearning\\lib\\site-packages (from pandas>=1.2->bokeh>=2.0.0->streamlit-bokeh-events) (2023.3)\n",
      "Requirement already satisfied: charset-normalizer<4,>=2 in c:\\users\\umesh\\anaconda3\\envs\\deeplearning\\lib\\site-packages (from requests<3,>=2.27->streamlit>=0.63->streamlit-bokeh-events) (2.0.4)\n",
      "Requirement already satisfied: idna<4,>=2.5 in c:\\users\\umesh\\anaconda3\\envs\\deeplearning\\lib\\site-packages (from requests<3,>=2.27->streamlit>=0.63->streamlit-bokeh-events) (3.4)\n",
      "Requirement already satisfied: urllib3<3,>=1.21.1 in c:\\users\\umesh\\anaconda3\\envs\\deeplearning\\lib\\site-packages (from requests<3,>=2.27->streamlit>=0.63->streamlit-bokeh-events) (1.26.18)\n",
      "Requirement already satisfied: certifi>=2017.4.17 in c:\\users\\umesh\\anaconda3\\envs\\deeplearning\\lib\\site-packages (from requests<3,>=2.27->streamlit>=0.63->streamlit-bokeh-events) (2024.2.2)\n",
      "Requirement already satisfied: markdown-it-py>=2.2.0 in c:\\users\\umesh\\anaconda3\\envs\\deeplearning\\lib\\site-packages (from rich<14,>=10.14.0->streamlit>=0.63->streamlit-bokeh-events) (3.0.0)\n",
      "Requirement already satisfied: pygments<3.0.0,>=2.13.0 in c:\\users\\umesh\\anaconda3\\envs\\deeplearning\\lib\\site-packages (from rich<14,>=10.14.0->streamlit>=0.63->streamlit-bokeh-events) (2.15.1)\n",
      "Requirement already satisfied: smmap<6,>=3.0.1 in c:\\users\\umesh\\anaconda3\\envs\\deeplearning\\lib\\site-packages (from gitdb<5,>=4.0.1->gitpython!=3.1.19,<4,>=3.0.7->streamlit>=0.63->streamlit-bokeh-events) (5.0.1)\n",
      "Requirement already satisfied: attrs>=22.2.0 in c:\\users\\umesh\\anaconda3\\envs\\deeplearning\\lib\\site-packages (from jsonschema>=3.0->altair<6,>=4.0->streamlit>=0.63->streamlit-bokeh-events) (23.1.0)\n",
      "Requirement already satisfied: jsonschema-specifications>=2023.03.6 in c:\\users\\umesh\\anaconda3\\envs\\deeplearning\\lib\\site-packages (from jsonschema>=3.0->altair<6,>=4.0->streamlit>=0.63->streamlit-bokeh-events) (2023.7.1)\n",
      "Requirement already satisfied: referencing>=0.28.4 in c:\\users\\umesh\\anaconda3\\envs\\deeplearning\\lib\\site-packages (from jsonschema>=3.0->altair<6,>=4.0->streamlit>=0.63->streamlit-bokeh-events) (0.30.2)\n",
      "Requirement already satisfied: rpds-py>=0.7.1 in c:\\users\\umesh\\anaconda3\\envs\\deeplearning\\lib\\site-packages (from jsonschema>=3.0->altair<6,>=4.0->streamlit>=0.63->streamlit-bokeh-events) (0.10.6)\n",
      "Requirement already satisfied: mdurl~=0.1 in c:\\users\\umesh\\anaconda3\\envs\\deeplearning\\lib\\site-packages (from markdown-it-py>=2.2.0->rich<14,>=10.14.0->streamlit>=0.63->streamlit-bokeh-events) (0.1.2)\n",
      "Requirement already satisfied: six>=1.5 in c:\\users\\umesh\\anaconda3\\envs\\deeplearning\\lib\\site-packages (from python-dateutil>=2.8.2->pandas>=1.2->bokeh>=2.0.0->streamlit-bokeh-events) (1.16.0)\n",
      "Downloading streamlit_bokeh_events-0.1.2-py3-none-any.whl (2.0 MB)\n",
      "   ---------------------------------------- 0.0/2.0 MB ? eta -:--:--\n",
      "   ---------------------------------------- 0.0/2.0 MB ? eta -:--:--\n",
      "   ---------------------------------------- 0.0/2.0 MB ? eta -:--:--\n",
      "   ---------------------------------------- 0.0/2.0 MB ? eta -:--:--\n",
      "   ---------------------------------------- 0.0/2.0 MB ? eta -:--:--\n",
      "   ---------------------------------------- 0.0/2.0 MB 93.1 kB/s eta 0:00:21\n",
      "    --------------------------------------- 0.0/2.0 MB 108.9 kB/s eta 0:00:18\n",
      "    --------------------------------------- 0.0/2.0 MB 108.9 kB/s eta 0:00:18\n",
      "    --------------------------------------- 0.0/2.0 MB 108.9 kB/s eta 0:00:18\n",
      "    --------------------------------------- 0.0/2.0 MB 108.9 kB/s eta 0:00:18\n",
      "    --------------------------------------- 0.0/2.0 MB 85.3 kB/s eta 0:00:23\n",
      "    --------------------------------------- 0.0/2.0 MB 85.3 kB/s eta 0:00:23\n",
      "   - -------------------------------------- 0.1/2.0 MB 109.2 kB/s eta 0:00:18\n",
      "   - -------------------------------------- 0.1/2.0 MB 109.2 kB/s eta 0:00:18\n",
      "   - -------------------------------------- 0.1/2.0 MB 109.2 kB/s eta 0:00:18\n",
      "   - -------------------------------------- 0.1/2.0 MB 120.7 kB/s eta 0:00:16\n",
      "   - -------------------------------------- 0.1/2.0 MB 120.7 kB/s eta 0:00:16\n",
      "   - -------------------------------------- 0.1/2.0 MB 120.7 kB/s eta 0:00:16\n",
      "   - -------------------------------------- 0.1/2.0 MB 120.7 kB/s eta 0:00:16\n",
      "   - -------------------------------------- 0.1/2.0 MB 120.7 kB/s eta 0:00:16\n",
      "   - -------------------------------------- 0.1/2.0 MB 120.7 kB/s eta 0:00:16\n",
      "   - -------------------------------------- 0.1/2.0 MB 120.7 kB/s eta 0:00:16\n",
      "   - -------------------------------------- 0.1/2.0 MB 120.7 kB/s eta 0:00:16\n",
      "   - -------------------------------------- 0.1/2.0 MB 120.7 kB/s eta 0:00:16\n",
      "   - -------------------------------------- 0.1/2.0 MB 120.7 kB/s eta 0:00:16\n",
      "   - -------------------------------------- 0.1/2.0 MB 120.7 kB/s eta 0:00:16\n",
      "   - -------------------------------------- 0.1/2.0 MB 120.7 kB/s eta 0:00:16\n",
      "   - -------------------------------------- 0.1/2.0 MB 120.7 kB/s eta 0:00:16\n",
      "   - -------------------------------------- 0.1/2.0 MB 120.7 kB/s eta 0:00:16\n",
      "   - -------------------------------------- 0.1/2.0 MB 64.7 kB/s eta 0:00:29\n",
      "   - -------------------------------------- 0.1/2.0 MB 64.7 kB/s eta 0:00:29\n",
      "   - -------------------------------------- 0.1/2.0 MB 64.7 kB/s eta 0:00:29\n",
      "   -- ------------------------------------- 0.1/2.0 MB 73.6 kB/s eta 0:00:26\n",
      "   -- ------------------------------------- 0.1/2.0 MB 73.6 kB/s eta 0:00:26\n",
      "   -- ------------------------------------- 0.1/2.0 MB 73.6 kB/s eta 0:00:26\n",
      "   -- ------------------------------------- 0.1/2.0 MB 72.1 kB/s eta 0:00:26\n",
      "   -- ------------------------------------- 0.1/2.0 MB 72.1 kB/s eta 0:00:26\n",
      "   -- ------------------------------------- 0.1/2.0 MB 72.1 kB/s eta 0:00:26\n",
      "   -- ------------------------------------- 0.1/2.0 MB 79.6 kB/s eta 0:00:23\n",
      "   -- ------------------------------------- 0.1/2.0 MB 79.6 kB/s eta 0:00:23\n",
      "   -- ------------------------------------- 0.1/2.0 MB 79.6 kB/s eta 0:00:23\n",
      "   --- ------------------------------------ 0.2/2.0 MB 84.0 kB/s eta 0:00:22\n",
      "   --- ------------------------------------ 0.2/2.0 MB 84.0 kB/s eta 0:00:22\n",
      "   --- ------------------------------------ 0.2/2.0 MB 83.9 kB/s eta 0:00:22\n",
      "   --- ------------------------------------ 0.2/2.0 MB 83.9 kB/s eta 0:00:22\n",
      "   --- ------------------------------------ 0.2/2.0 MB 88.7 kB/s eta 0:00:20\n",
      "   --- ------------------------------------ 0.2/2.0 MB 88.7 kB/s eta 0:00:20\n",
      "   --- ------------------------------------ 0.2/2.0 MB 88.7 kB/s eta 0:00:20\n",
      "   ---- ----------------------------------- 0.2/2.0 MB 88.9 kB/s eta 0:00:20\n",
      "   ---- ----------------------------------- 0.2/2.0 MB 88.9 kB/s eta 0:00:20\n",
      "   ---- ----------------------------------- 0.2/2.0 MB 93.6 kB/s eta 0:00:19\n",
      "   ---- ----------------------------------- 0.2/2.0 MB 93.6 kB/s eta 0:00:19\n",
      "   ----- ---------------------------------- 0.2/2.0 MB 97.8 kB/s eta 0:00:18\n",
      "   ----- ---------------------------------- 0.2/2.0 MB 97.8 kB/s eta 0:00:18\n",
      "   ----- ---------------------------------- 0.3/2.0 MB 98.3 kB/s eta 0:00:18\n",
      "   ----- ---------------------------------- 0.3/2.0 MB 98.3 kB/s eta 0:00:18\n",
      "   ----- ---------------------------------- 0.3/2.0 MB 102.6 kB/s eta 0:00:17\n",
      "   ----- ---------------------------------- 0.3/2.0 MB 102.6 kB/s eta 0:00:17\n",
      "   ----- ---------------------------------- 0.3/2.0 MB 102.3 kB/s eta 0:00:17\n",
      "   ----- ---------------------------------- 0.3/2.0 MB 102.3 kB/s eta 0:00:17\n",
      "   ------ --------------------------------- 0.3/2.0 MB 105.6 kB/s eta 0:00:16\n",
      "   ------ --------------------------------- 0.3/2.0 MB 105.6 kB/s eta 0:00:16\n",
      "   ------ --------------------------------- 0.3/2.0 MB 105.6 kB/s eta 0:00:16\n",
      "   ------ --------------------------------- 0.3/2.0 MB 108.6 kB/s eta 0:00:15\n",
      "   ------ --------------------------------- 0.3/2.0 MB 108.6 kB/s eta 0:00:15\n",
      "   ------ --------------------------------- 0.3/2.0 MB 108.1 kB/s eta 0:00:15\n",
      "   ------ --------------------------------- 0.3/2.0 MB 108.1 kB/s eta 0:00:15\n",
      "   ------ --------------------------------- 0.3/2.0 MB 108.1 kB/s eta 0:00:15\n",
      "   ------- -------------------------------- 0.4/2.0 MB 109.2 kB/s eta 0:00:15\n",
      "   ------- -------------------------------- 0.4/2.0 MB 109.2 kB/s eta 0:00:15\n",
      "   ------- -------------------------------- 0.4/2.0 MB 109.2 kB/s eta 0:00:15\n",
      "   ------- -------------------------------- 0.4/2.0 MB 109.2 kB/s eta 0:00:15\n",
      "   ------- -------------------------------- 0.4/2.0 MB 111.7 kB/s eta 0:00:15\n",
      "   ------- -------------------------------- 0.4/2.0 MB 111.7 kB/s eta 0:00:15\n",
      "   -------- ------------------------------- 0.4/2.0 MB 114.1 kB/s eta 0:00:14\n",
      "   -------- ------------------------------- 0.4/2.0 MB 114.1 kB/s eta 0:00:14\n",
      "   -------- ------------------------------- 0.4/2.0 MB 114.1 kB/s eta 0:00:14\n",
      "   -------- ------------------------------- 0.4/2.0 MB 113.5 kB/s eta 0:00:14\n",
      "   -------- ------------------------------- 0.4/2.0 MB 113.5 kB/s eta 0:00:14\n",
      "   --------- ------------------------------ 0.4/2.0 MB 116.1 kB/s eta 0:00:14\n",
      "   --------- ------------------------------ 0.4/2.0 MB 116.1 kB/s eta 0:00:14\n",
      "   --------- ------------------------------ 0.5/2.0 MB 115.5 kB/s eta 0:00:14\n",
      "   --------- ------------------------------ 0.5/2.0 MB 115.5 kB/s eta 0:00:14\n",
      "   --------- ------------------------------ 0.5/2.0 MB 115.5 kB/s eta 0:00:14\n",
      "   --------- ------------------------------ 0.5/2.0 MB 117.5 kB/s eta 0:00:13\n",
      "   --------- ------------------------------ 0.5/2.0 MB 117.5 kB/s eta 0:00:13\n",
      "   ---------- ----------------------------- 0.5/2.0 MB 118.9 kB/s eta 0:00:13\n",
      "   ---------- ----------------------------- 0.5/2.0 MB 118.9 kB/s eta 0:00:13\n",
      "   ---------- ----------------------------- 0.5/2.0 MB 118.7 kB/s eta 0:00:13\n",
      "   ---------- ----------------------------- 0.5/2.0 MB 118.7 kB/s eta 0:00:13\n",
      "   ---------- ----------------------------- 0.5/2.0 MB 118.7 kB/s eta 0:00:13\n",
      "   ---------- ----------------------------- 0.5/2.0 MB 119.6 kB/s eta 0:00:12\n",
      "   ---------- ----------------------------- 0.5/2.0 MB 119.6 kB/s eta 0:00:12\n",
      "   ---------- ----------------------------- 0.5/2.0 MB 119.6 kB/s eta 0:00:12\n",
      "   ---------- ----------------------------- 0.5/2.0 MB 118.9 kB/s eta 0:00:12\n",
      "   ---------- ----------------------------- 0.5/2.0 MB 118.9 kB/s eta 0:00:12\n",
      "   ----------- ---------------------------- 0.6/2.0 MB 120.2 kB/s eta 0:00:12\n",
      "   ----------- ---------------------------- 0.6/2.0 MB 120.2 kB/s eta 0:00:12\n",
      "   ----------- ---------------------------- 0.6/2.0 MB 120.2 kB/s eta 0:00:12\n",
      "   ----------- ---------------------------- 0.6/2.0 MB 121.8 kB/s eta 0:00:12\n",
      "   ----------- ---------------------------- 0.6/2.0 MB 121.8 kB/s eta 0:00:12\n",
      "   ----------- ---------------------------- 0.6/2.0 MB 120.7 kB/s eta 0:00:12\n",
      "   ----------- ---------------------------- 0.6/2.0 MB 120.7 kB/s eta 0:00:12\n",
      "   ----------- ---------------------------- 0.6/2.0 MB 120.7 kB/s eta 0:00:12\n",
      "   ------------ --------------------------- 0.6/2.0 MB 122.2 kB/s eta 0:00:12\n",
      "   ------------ --------------------------- 0.6/2.0 MB 122.2 kB/s eta 0:00:12\n",
      "   ------------ --------------------------- 0.6/2.0 MB 121.2 kB/s eta 0:00:12\n",
      "   ------------ --------------------------- 0.6/2.0 MB 121.2 kB/s eta 0:00:12\n",
      "   ------------ --------------------------- 0.6/2.0 MB 121.2 kB/s eta 0:00:12\n",
      "   ------------ --------------------------- 0.6/2.0 MB 121.2 kB/s eta 0:00:12\n",
      "   ------------ --------------------------- 0.6/2.0 MB 121.2 kB/s eta 0:00:12\n",
      "   ------------ --------------------------- 0.6/2.0 MB 120.8 kB/s eta 0:00:11\n",
      "   ------------ --------------------------- 0.6/2.0 MB 120.8 kB/s eta 0:00:11\n",
      "   ------------- -------------------------- 0.7/2.0 MB 122.1 kB/s eta 0:00:11\n",
      "   ------------- -------------------------- 0.7/2.0 MB 122.1 kB/s eta 0:00:11\n",
      "   ------------- -------------------------- 0.7/2.0 MB 122.1 kB/s eta 0:00:11\n",
      "   ------------- -------------------------- 0.7/2.0 MB 120.9 kB/s eta 0:00:11\n",
      "   ------------- -------------------------- 0.7/2.0 MB 120.9 kB/s eta 0:00:11\n",
      "   ------------- -------------------------- 0.7/2.0 MB 120.9 kB/s eta 0:00:11\n",
      "   -------------- ------------------------- 0.7/2.0 MB 121.8 kB/s eta 0:00:11\n",
      "   -------------- ------------------------- 0.7/2.0 MB 121.8 kB/s eta 0:00:11\n",
      "   -------------- ------------------------- 0.7/2.0 MB 121.3 kB/s eta 0:00:11\n",
      "   -------------- ------------------------- 0.7/2.0 MB 121.3 kB/s eta 0:00:11\n",
      "   -------------- ------------------------- 0.7/2.0 MB 122.9 kB/s eta 0:00:11\n",
      "   -------------- ------------------------- 0.7/2.0 MB 122.9 kB/s eta 0:00:11\n",
      "   --------------- ------------------------ 0.7/2.0 MB 124.1 kB/s eta 0:00:10\n",
      "   --------------- ------------------------ 0.7/2.0 MB 124.1 kB/s eta 0:00:10\n",
      "   --------------- ------------------------ 0.7/2.0 MB 124.1 kB/s eta 0:00:10\n",
      "   --------------- ------------------------ 0.7/2.0 MB 123.5 kB/s eta 0:00:10\n",
      "   --------------- ------------------------ 0.7/2.0 MB 123.5 kB/s eta 0:00:10\n",
      "   --------------- ------------------------ 0.8/2.0 MB 124.3 kB/s eta 0:00:10\n",
      "   --------------- ------------------------ 0.8/2.0 MB 124.3 kB/s eta 0:00:10\n",
      "   --------------- ------------------------ 0.8/2.0 MB 124.1 kB/s eta 0:00:10\n",
      "   --------------- ------------------------ 0.8/2.0 MB 124.1 kB/s eta 0:00:10\n",
      "   --------------- ------------------------ 0.8/2.0 MB 124.1 kB/s eta 0:00:10\n",
      "   ---------------- ----------------------- 0.8/2.0 MB 124.9 kB/s eta 0:00:10\n",
      "   ---------------- ----------------------- 0.8/2.0 MB 124.9 kB/s eta 0:00:10\n",
      "   ---------------- ----------------------- 0.8/2.0 MB 124.9 kB/s eta 0:00:10\n",
      "   ---------------- ----------------------- 0.8/2.0 MB 125.4 kB/s eta 0:00:10\n",
      "   ---------------- ----------------------- 0.8/2.0 MB 125.4 kB/s eta 0:00:10\n",
      "   ---------------- ----------------------- 0.8/2.0 MB 125.4 kB/s eta 0:00:10\n",
      "   ---------------- ----------------------- 0.8/2.0 MB 125.4 kB/s eta 0:00:10\n",
      "   ---------------- ----------------------- 0.8/2.0 MB 125.4 kB/s eta 0:00:10\n",
      "   ---------------- ----------------------- 0.8/2.0 MB 125.4 kB/s eta 0:00:10\n",
      "   ---------------- ----------------------- 0.8/2.0 MB 125.4 kB/s eta 0:00:10\n",
      "   ---------------- ----------------------- 0.8/2.0 MB 125.4 kB/s eta 0:00:10\n",
      "   ---------------- ----------------------- 0.8/2.0 MB 125.4 kB/s eta 0:00:10\n",
      "   ---------------- ----------------------- 0.8/2.0 MB 125.4 kB/s eta 0:00:10\n",
      "   ---------------- ----------------------- 0.8/2.0 MB 125.4 kB/s eta 0:00:10\n",
      "   ---------------- ----------------------- 0.8/2.0 MB 125.4 kB/s eta 0:00:10\n",
      "   ---------------- ----------------------- 0.8/2.0 MB 125.4 kB/s eta 0:00:10\n",
      "   ---------------- ----------------------- 0.8/2.0 MB 125.4 kB/s eta 0:00:10\n",
      "   ---------------- ----------------------- 0.8/2.0 MB 125.4 kB/s eta 0:00:10\n",
      "   ---------------- ----------------------- 0.8/2.0 MB 125.4 kB/s eta 0:00:10\n",
      "   ---------------- ----------------------- 0.8/2.0 MB 114.0 kB/s eta 0:00:10\n",
      "   ---------------- ----------------------- 0.8/2.0 MB 114.0 kB/s eta 0:00:10\n",
      "   ----------------- ---------------------- 0.8/2.0 MB 115.1 kB/s eta 0:00:10\n",
      "   ----------------- ---------------------- 0.8/2.0 MB 115.1 kB/s eta 0:00:10\n",
      "   ----------------- ---------------------- 0.9/2.0 MB 114.7 kB/s eta 0:00:10\n",
      "   ----------------- ---------------------- 0.9/2.0 MB 114.7 kB/s eta 0:00:10\n",
      "   ----------------- ---------------------- 0.9/2.0 MB 114.7 kB/s eta 0:00:10\n",
      "   ------------------ --------------------- 0.9/2.0 MB 116.1 kB/s eta 0:00:10\n",
      "   ------------------ --------------------- 0.9/2.0 MB 116.1 kB/s eta 0:00:10\n",
      "   ------------------ --------------------- 0.9/2.0 MB 116.1 kB/s eta 0:00:10\n",
      "   ------------------ --------------------- 0.9/2.0 MB 116.1 kB/s eta 0:00:10\n",
      "   ------------------ --------------------- 0.9/2.0 MB 116.1 kB/s eta 0:00:10\n",
      "   ------------------ --------------------- 0.9/2.0 MB 116.1 kB/s eta 0:00:10\n",
      "   ------------------ --------------------- 0.9/2.0 MB 116.1 kB/s eta 0:00:10\n",
      "   ------------------ --------------------- 0.9/2.0 MB 116.1 kB/s eta 0:00:10\n",
      "   ------------------ --------------------- 0.9/2.0 MB 116.1 kB/s eta 0:00:10\n",
      "   ------------------ --------------------- 0.9/2.0 MB 116.1 kB/s eta 0:00:10\n",
      "   ------------------ --------------------- 0.9/2.0 MB 116.1 kB/s eta 0:00:10\n",
      "   ------------------ --------------------- 0.9/2.0 MB 116.1 kB/s eta 0:00:10\n",
      "   ------------------ --------------------- 0.9/2.0 MB 116.1 kB/s eta 0:00:10\n",
      "   ------------------ --------------------- 0.9/2.0 MB 109.6 kB/s eta 0:00:10\n",
      "   ------------------ --------------------- 0.9/2.0 MB 109.6 kB/s eta 0:00:10\n",
      "   ------------------ --------------------- 0.9/2.0 MB 109.6 kB/s eta 0:00:10\n",
      "   ------------------ --------------------- 0.9/2.0 MB 109.6 kB/s eta 0:00:10\n",
      "   ------------------- -------------------- 0.9/2.0 MB 110.9 kB/s eta 0:00:10\n",
      "   ------------------- -------------------- 0.9/2.0 MB 110.9 kB/s eta 0:00:10\n",
      "   ------------------- -------------------- 0.9/2.0 MB 110.6 kB/s eta 0:00:10\n",
      "   ------------------- -------------------- 0.9/2.0 MB 110.6 kB/s eta 0:00:10\n",
      "   ------------------- -------------------- 0.9/2.0 MB 110.6 kB/s eta 0:00:10\n",
      "   ------------------- -------------------- 0.9/2.0 MB 110.6 kB/s eta 0:00:10\n",
      "   ------------------- -------------------- 0.9/2.0 MB 110.6 kB/s eta 0:00:10\n",
      "   ------------------- -------------------- 0.9/2.0 MB 110.6 kB/s eta 0:00:10\n",
      "   ------------------- -------------------- 0.9/2.0 MB 110.6 kB/s eta 0:00:10\n",
      "   ------------------- -------------------- 0.9/2.0 MB 110.6 kB/s eta 0:00:10\n",
      "   ------------------- -------------------- 1.0/2.0 MB 108.6 kB/s eta 0:00:10\n",
      "   ------------------- -------------------- 1.0/2.0 MB 108.6 kB/s eta 0:00:10\n",
      "   ------------------- -------------------- 1.0/2.0 MB 108.6 kB/s eta 0:00:10\n",
      "   -------------------- ------------------- 1.0/2.0 MB 109.2 kB/s eta 0:00:09\n",
      "   -------------------- ------------------- 1.0/2.0 MB 109.2 kB/s eta 0:00:09\n",
      "   -------------------- ------------------- 1.0/2.0 MB 109.0 kB/s eta 0:00:09\n",
      "   -------------------- ------------------- 1.0/2.0 MB 109.0 kB/s eta 0:00:09\n",
      "   -------------------- ------------------- 1.0/2.0 MB 109.0 kB/s eta 0:00:09\n",
      "   -------------------- ------------------- 1.0/2.0 MB 109.0 kB/s eta 0:00:09\n",
      "   -------------------- ------------------- 1.0/2.0 MB 109.0 kB/s eta 0:00:09\n",
      "   -------------------- ------------------- 1.0/2.0 MB 109.0 kB/s eta 0:00:09\n",
      "   -------------------- ------------------- 1.0/2.0 MB 109.0 kB/s eta 0:00:09\n",
      "   -------------------- ------------------- 1.0/2.0 MB 109.0 kB/s eta 0:00:09\n",
      "   -------------------- ------------------- 1.0/2.0 MB 107.2 kB/s eta 0:00:09\n",
      "   -------------------- ------------------- 1.0/2.0 MB 107.2 kB/s eta 0:00:09\n",
      "   -------------------- ------------------- 1.0/2.0 MB 107.2 kB/s eta 0:00:09\n",
      "   -------------------- ------------------- 1.0/2.0 MB 107.2 kB/s eta 0:00:09\n",
      "   --------------------- ------------------ 1.0/2.0 MB 108.0 kB/s eta 0:00:09\n",
      "   --------------------- ------------------ 1.0/2.0 MB 108.0 kB/s eta 0:00:09\n",
      "   --------------------- ------------------ 1.0/2.0 MB 108.0 kB/s eta 0:00:09\n",
      "   --------------------- ------------------ 1.1/2.0 MB 108.5 kB/s eta 0:00:09\n",
      "   --------------------- ------------------ 1.1/2.0 MB 108.5 kB/s eta 0:00:09\n",
      "   --------------------- ------------------ 1.1/2.0 MB 108.5 kB/s eta 0:00:09\n",
      "   --------------------- ------------------ 1.1/2.0 MB 108.5 kB/s eta 0:00:09\n",
      "   --------------------- ------------------ 1.1/2.0 MB 107.8 kB/s eta 0:00:09\n",
      "   --------------------- ------------------ 1.1/2.0 MB 107.8 kB/s eta 0:00:09\n",
      "   ---------------------- ----------------- 1.1/2.0 MB 108.5 kB/s eta 0:00:08\n",
      "   ---------------------- ----------------- 1.1/2.0 MB 108.5 kB/s eta 0:00:08\n",
      "   ---------------------- ----------------- 1.1/2.0 MB 108.5 kB/s eta 0:00:08\n",
      "   ---------------------- ----------------- 1.1/2.0 MB 108.0 kB/s eta 0:00:08\n",
      "   ---------------------- ----------------- 1.1/2.0 MB 108.0 kB/s eta 0:00:08\n",
      "   ---------------------- ----------------- 1.1/2.0 MB 108.0 kB/s eta 0:00:08\n",
      "   ----------------------- ---------------- 1.1/2.0 MB 108.9 kB/s eta 0:00:08\n",
      "   ----------------------- ---------------- 1.1/2.0 MB 108.9 kB/s eta 0:00:08\n",
      "   ----------------------- ---------------- 1.1/2.0 MB 108.9 kB/s eta 0:00:08\n",
      "   ----------------------- ---------------- 1.1/2.0 MB 109.4 kB/s eta 0:00:08\n",
      "   ----------------------- ---------------- 1.1/2.0 MB 109.4 kB/s eta 0:00:08\n",
      "   ----------------------- ---------------- 1.2/2.0 MB 109.2 kB/s eta 0:00:08\n",
      "   ----------------------- ---------------- 1.2/2.0 MB 109.2 kB/s eta 0:00:08\n",
      "   ----------------------- ---------------- 1.2/2.0 MB 109.2 kB/s eta 0:00:08\n",
      "   ------------------------ --------------- 1.2/2.0 MB 109.9 kB/s eta 0:00:08\n",
      "   ------------------------ --------------- 1.2/2.0 MB 109.9 kB/s eta 0:00:08\n",
      "   ------------------------ --------------- 1.2/2.0 MB 109.7 kB/s eta 0:00:08\n",
      "   ------------------------ --------------- 1.2/2.0 MB 109.7 kB/s eta 0:00:08\n",
      "   ------------------------ --------------- 1.2/2.0 MB 109.7 kB/s eta 0:00:08\n",
      "   ------------------------ --------------- 1.2/2.0 MB 110.3 kB/s eta 0:00:07\n",
      "   ------------------------ --------------- 1.2/2.0 MB 110.3 kB/s eta 0:00:07\n",
      "   ------------------------- -------------- 1.2/2.0 MB 111.1 kB/s eta 0:00:07\n",
      "   ------------------------- -------------- 1.2/2.0 MB 111.1 kB/s eta 0:00:07\n",
      "   ------------------------- -------------- 1.2/2.0 MB 111.1 kB/s eta 0:00:07\n",
      "   ------------------------- -------------- 1.2/2.0 MB 111.1 kB/s eta 0:00:07\n",
      "   ------------------------- -------------- 1.2/2.0 MB 110.1 kB/s eta 0:00:07\n",
      "   ------------------------- -------------- 1.2/2.0 MB 110.1 kB/s eta 0:00:07\n",
      "   ------------------------- -------------- 1.2/2.0 MB 110.1 kB/s eta 0:00:07\n",
      "   ------------------------- -------------- 1.3/2.0 MB 110.6 kB/s eta 0:00:07\n",
      "   ------------------------- -------------- 1.3/2.0 MB 110.6 kB/s eta 0:00:07\n",
      "   ------------------------- -------------- 1.3/2.0 MB 110.6 kB/s eta 0:00:07\n",
      "   ------------------------- -------------- 1.3/2.0 MB 110.3 kB/s eta 0:00:07\n",
      "   ------------------------- -------------- 1.3/2.0 MB 110.3 kB/s eta 0:00:07\n",
      "   ------------------------- -------------- 1.3/2.0 MB 110.3 kB/s eta 0:00:07\n",
      "   ------------------------- -------------- 1.3/2.0 MB 110.3 kB/s eta 0:00:07\n",
      "   ------------------------- -------------- 1.3/2.0 MB 110.3 kB/s eta 0:00:07\n",
      "   ------------------------- -------------- 1.3/2.0 MB 110.3 kB/s eta 0:00:07\n",
      "   -------------------------- ------------- 1.3/2.0 MB 109.4 kB/s eta 0:00:07\n",
      "   -------------------------- ------------- 1.3/2.0 MB 110.4 kB/s eta 0:00:06\n",
      "   -------------------------- ------------- 1.3/2.0 MB 110.4 kB/s eta 0:00:06\n",
      "   -------------------------- ------------- 1.3/2.0 MB 110.4 kB/s eta 0:00:06\n",
      "   --------------------------- ------------ 1.3/2.0 MB 110.1 kB/s eta 0:00:06\n",
      "   --------------------------- ------------ 1.3/2.0 MB 110.1 kB/s eta 0:00:06\n",
      "   --------------------------- ------------ 1.3/2.0 MB 110.8 kB/s eta 0:00:06\n",
      "   --------------------------- ------------ 1.3/2.0 MB 110.8 kB/s eta 0:00:06\n",
      "   --------------------------- ------------ 1.3/2.0 MB 110.8 kB/s eta 0:00:06\n",
      "   --------------------------- ------------ 1.3/2.0 MB 110.8 kB/s eta 0:00:06\n",
      "   --------------------------- ------------ 1.3/2.0 MB 110.8 kB/s eta 0:00:06\n",
      "   --------------------------- ------------ 1.3/2.0 MB 110.8 kB/s eta 0:00:06\n",
      "   --------------------------- ------------ 1.3/2.0 MB 110.8 kB/s eta 0:00:06\n",
      "   --------------------------- ------------ 1.3/2.0 MB 110.8 kB/s eta 0:00:06\n",
      "   --------------------------- ------------ 1.3/2.0 MB 110.8 kB/s eta 0:00:06\n",
      "   --------------------------- ------------ 1.3/2.0 MB 110.8 kB/s eta 0:00:06\n",
      "   --------------------------- ------------ 1.3/2.0 MB 110.8 kB/s eta 0:00:06\n",
      "   --------------------------- ------------ 1.4/2.0 MB 107.2 kB/s eta 0:00:06\n",
      "   --------------------------- ------------ 1.4/2.0 MB 107.2 kB/s eta 0:00:06\n",
      "   ---------------------------- ----------- 1.4/2.0 MB 108.1 kB/s eta 0:00:06\n",
      "   ---------------------------- ----------- 1.4/2.0 MB 108.1 kB/s eta 0:00:06\n",
      "   ---------------------------- ----------- 1.4/2.0 MB 108.7 kB/s eta 0:00:06\n",
      "   ---------------------------- ----------- 1.4/2.0 MB 108.7 kB/s eta 0:00:06\n",
      "   ---------------------------- ----------- 1.4/2.0 MB 108.7 kB/s eta 0:00:06\n",
      "   ---------------------------- ----------- 1.4/2.0 MB 108.6 kB/s eta 0:00:06\n",
      "   ---------------------------- ----------- 1.4/2.0 MB 108.6 kB/s eta 0:00:06\n",
      "   ---------------------------- ----------- 1.4/2.0 MB 108.6 kB/s eta 0:00:06\n",
      "   ---------------------------- ----------- 1.4/2.0 MB 108.6 kB/s eta 0:00:06\n",
      "   ---------------------------- ----------- 1.4/2.0 MB 108.6 kB/s eta 0:00:06\n",
      "   ---------------------------- ----------- 1.4/2.0 MB 108.6 kB/s eta 0:00:06\n",
      "   ---------------------------- ----------- 1.4/2.0 MB 108.6 kB/s eta 0:00:06\n",
      "   ---------------------------- ----------- 1.4/2.0 MB 108.6 kB/s eta 0:00:06\n",
      "   ---------------------------- ----------- 1.4/2.0 MB 108.6 kB/s eta 0:00:06\n",
      "   ----------------------------- ---------- 1.4/2.0 MB 106.3 kB/s eta 0:00:06\n",
      "   ----------------------------- ---------- 1.4/2.0 MB 106.3 kB/s eta 0:00:06\n",
      "   ----------------------------- ---------- 1.4/2.0 MB 106.4 kB/s eta 0:00:05\n",
      "   ----------------------------- ---------- 1.4/2.0 MB 106.4 kB/s eta 0:00:05\n",
      "   ----------------------------- ---------- 1.4/2.0 MB 106.4 kB/s eta 0:00:05\n",
      "   ----------------------------- ---------- 1.4/2.0 MB 106.4 kB/s eta 0:00:05\n",
      "   ----------------------------- ---------- 1.5/2.0 MB 106.2 kB/s eta 0:00:05\n",
      "   ----------------------------- ---------- 1.5/2.0 MB 106.2 kB/s eta 0:00:05\n",
      "   ----------------------------- ---------- 1.5/2.0 MB 106.2 kB/s eta 0:00:05\n",
      "   ------------------------------ --------- 1.5/2.0 MB 106.9 kB/s eta 0:00:05\n",
      "   ------------------------------ --------- 1.5/2.0 MB 106.9 kB/s eta 0:00:05\n",
      "   ------------------------------ --------- 1.5/2.0 MB 106.8 kB/s eta 0:00:05\n",
      "   ------------------------------ --------- 1.5/2.0 MB 106.8 kB/s eta 0:00:05\n",
      "   ------------------------------ --------- 1.5/2.0 MB 106.8 kB/s eta 0:00:05\n",
      "   ------------------------------ --------- 1.5/2.0 MB 107.4 kB/s eta 0:00:05\n",
      "   ------------------------------ --------- 1.5/2.0 MB 107.4 kB/s eta 0:00:05\n",
      "   ------------------------------ --------- 1.5/2.0 MB 107.4 kB/s eta 0:00:05\n",
      "   ------------------------------ --------- 1.5/2.0 MB 107.4 kB/s eta 0:00:05\n",
      "   ------------------------------ --------- 1.5/2.0 MB 107.4 kB/s eta 0:00:05\n",
      "   ------------------------------- -------- 1.5/2.0 MB 107.7 kB/s eta 0:00:04\n",
      "   ------------------------------- -------- 1.5/2.0 MB 107.7 kB/s eta 0:00:04\n",
      "   ------------------------------- -------- 1.6/2.0 MB 108.3 kB/s eta 0:00:04\n",
      "   ------------------------------- -------- 1.6/2.0 MB 108.3 kB/s eta 0:00:04\n",
      "   -------------------------------- ------- 1.6/2.0 MB 108.3 kB/s eta 0:00:04\n",
      "   -------------------------------- ------- 1.6/2.0 MB 108.3 kB/s eta 0:00:04\n",
      "   -------------------------------- ------- 1.6/2.0 MB 108.3 kB/s eta 0:00:04\n",
      "   -------------------------------- ------- 1.6/2.0 MB 108.9 kB/s eta 0:00:04\n",
      "   -------------------------------- ------- 1.6/2.0 MB 108.9 kB/s eta 0:00:04\n",
      "   -------------------------------- ------- 1.6/2.0 MB 108.8 kB/s eta 0:00:04\n",
      "   -------------------------------- ------- 1.6/2.0 MB 108.8 kB/s eta 0:00:04\n",
      "   --------------------------------- ------ 1.6/2.0 MB 109.3 kB/s eta 0:00:04\n",
      "   --------------------------------- ------ 1.6/2.0 MB 109.3 kB/s eta 0:00:04\n",
      "   --------------------------------- ------ 1.6/2.0 MB 109.3 kB/s eta 0:00:04\n",
      "   --------------------------------- ------ 1.6/2.0 MB 109.8 kB/s eta 0:00:03\n",
      "   --------------------------------- ------ 1.6/2.0 MB 109.8 kB/s eta 0:00:03\n",
      "   --------------------------------- ------ 1.6/2.0 MB 109.8 kB/s eta 0:00:03\n",
      "   --------------------------------- ------ 1.6/2.0 MB 109.8 kB/s eta 0:00:03\n",
      "   --------------------------------- ------ 1.6/2.0 MB 109.8 kB/s eta 0:00:03\n",
      "   ---------------------------------- ----- 1.7/2.0 MB 110.1 kB/s eta 0:00:03\n",
      "   ---------------------------------- ----- 1.7/2.0 MB 110.1 kB/s eta 0:00:03\n",
      "   ---------------------------------- ----- 1.7/2.0 MB 110.2 kB/s eta 0:00:03\n",
      "   ---------------------------------- ----- 1.7/2.0 MB 110.2 kB/s eta 0:00:03\n",
      "   ---------------------------------- ----- 1.7/2.0 MB 110.9 kB/s eta 0:00:03\n",
      "   ---------------------------------- ----- 1.7/2.0 MB 110.9 kB/s eta 0:00:03\n",
      "   ---------------------------------- ----- 1.7/2.0 MB 110.9 kB/s eta 0:00:03\n",
      "   ----------------------------------- ---- 1.7/2.0 MB 111.1 kB/s eta 0:00:03\n",
      "   ----------------------------------- ---- 1.7/2.0 MB 111.1 kB/s eta 0:00:03\n",
      "   ----------------------------------- ---- 1.7/2.0 MB 111.1 kB/s eta 0:00:03\n",
      "   ----------------------------------- ---- 1.7/2.0 MB 111.1 kB/s eta 0:00:03\n",
      "   ----------------------------------- ---- 1.7/2.0 MB 111.1 kB/s eta 0:00:03\n",
      "   ----------------------------------- ---- 1.8/2.0 MB 111.5 kB/s eta 0:00:02\n",
      "   ----------------------------------- ---- 1.8/2.0 MB 111.5 kB/s eta 0:00:02\n",
      "   ------------------------------------ --- 1.8/2.0 MB 111.2 kB/s eta 0:00:02\n",
      "   ------------------------------------ --- 1.8/2.0 MB 111.2 kB/s eta 0:00:02\n",
      "   ------------------------------------ --- 1.8/2.0 MB 111.2 kB/s eta 0:00:02\n",
      "   ------------------------------------ --- 1.8/2.0 MB 111.2 kB/s eta 0:00:02\n",
      "   ------------------------------------ --- 1.8/2.0 MB 111.2 kB/s eta 0:00:02\n",
      "   ------------------------------------ --- 1.8/2.0 MB 111.2 kB/s eta 0:00:02\n",
      "   ------------------------------------ --- 1.8/2.0 MB 111.2 kB/s eta 0:00:02\n",
      "   ------------------------------------ --- 1.8/2.0 MB 111.2 kB/s eta 0:00:02\n",
      "   ------------------------------------ --- 1.8/2.0 MB 110.0 kB/s eta 0:00:02\n",
      "   ------------------------------------ --- 1.8/2.0 MB 110.0 kB/s eta 0:00:02\n",
      "   ------------------------------------ --- 1.8/2.0 MB 110.0 kB/s eta 0:00:02\n",
      "   ------------------------------------ --- 1.8/2.0 MB 110.5 kB/s eta 0:00:02\n",
      "   ------------------------------------ --- 1.8/2.0 MB 110.5 kB/s eta 0:00:02\n",
      "   ------------------------------------- -- 1.8/2.0 MB 110.3 kB/s eta 0:00:02\n",
      "   ------------------------------------- -- 1.8/2.0 MB 110.3 kB/s eta 0:00:02\n",
      "   ------------------------------------- -- 1.8/2.0 MB 110.3 kB/s eta 0:00:02\n",
      "   ------------------------------------- -- 1.8/2.0 MB 110.8 kB/s eta 0:00:02\n",
      "   ------------------------------------- -- 1.8/2.0 MB 110.8 kB/s eta 0:00:02\n",
      "   ------------------------------------- -- 1.8/2.0 MB 110.8 kB/s eta 0:00:02\n",
      "   ------------------------------------- -- 1.8/2.0 MB 110.8 kB/s eta 0:00:02\n",
      "   ------------------------------------- -- 1.8/2.0 MB 110.8 kB/s eta 0:00:02\n",
      "   ------------------------------------- -- 1.8/2.0 MB 110.8 kB/s eta 0:00:02\n",
      "   ------------------------------------- -- 1.8/2.0 MB 110.8 kB/s eta 0:00:02\n",
      "   ------------------------------------- -- 1.8/2.0 MB 109.2 kB/s eta 0:00:02\n",
      "   ------------------------------------- -- 1.8/2.0 MB 109.2 kB/s eta 0:00:02\n",
      "   -------------------------------------- - 1.9/2.0 MB 109.8 kB/s eta 0:00:01\n",
      "   -------------------------------------- - 1.9/2.0 MB 109.8 kB/s eta 0:00:01\n",
      "   -------------------------------------- - 1.9/2.0 MB 110.2 kB/s eta 0:00:01\n",
      "   -------------------------------------- - 1.9/2.0 MB 110.2 kB/s eta 0:00:01\n",
      "   -------------------------------------- - 1.9/2.0 MB 110.2 kB/s eta 0:00:01\n",
      "   -------------------------------------- - 1.9/2.0 MB 110.1 kB/s eta 0:00:01\n",
      "   -------------------------------------- - 1.9/2.0 MB 110.1 kB/s eta 0:00:01\n",
      "   -------------------------------------- - 1.9/2.0 MB 110.1 kB/s eta 0:00:01\n",
      "   -------------------------------------- - 1.9/2.0 MB 110.1 kB/s eta 0:00:01\n",
      "   -------------------------------------- - 1.9/2.0 MB 110.1 kB/s eta 0:00:01\n",
      "   -------------------------------------- - 1.9/2.0 MB 110.1 kB/s eta 0:00:01\n",
      "   ---------------------------------------  1.9/2.0 MB 109.4 kB/s eta 0:00:01\n",
      "   ---------------------------------------  1.9/2.0 MB 109.4 kB/s eta 0:00:01\n",
      "   ---------------------------------------  1.9/2.0 MB 109.4 kB/s eta 0:00:01\n",
      "   ---------------------------------------  1.9/2.0 MB 109.1 kB/s eta 0:00:01\n",
      "   ---------------------------------------  1.9/2.0 MB 109.1 kB/s eta 0:00:01\n",
      "   ---------------------------------------  1.9/2.0 MB 109.1 kB/s eta 0:00:01\n",
      "   ---------------------------------------  1.9/2.0 MB 109.1 kB/s eta 0:00:01\n",
      "   ---------------------------------------  2.0/2.0 MB 109.7 kB/s eta 0:00:01\n",
      "   ---------------------------------------- 2.0/2.0 MB 109.4 kB/s eta 0:00:00\n",
      "Installing collected packages: streamlit-bokeh-events\n",
      "Successfully installed streamlit-bokeh-events-0.1.2\n",
      "Note: you may need to restart the kernel to use updated packages.\n"
     ]
    }
   ],
   "source": [
    "pip install streamlit-bokeh-events"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "2024-10-30 10:52:39.204 WARNING streamlit.runtime.scriptrunner_utils.script_run_context: Thread 'MainThread': missing ScriptRunContext! This warning can be ignored when running in bare mode.\n",
      "2024-10-30 10:52:39.276 WARNING streamlit.runtime.scriptrunner_utils.script_run_context: Thread 'MainThread': missing ScriptRunContext! This warning can be ignored when running in bare mode.\n",
      "2024-10-30 10:52:39.277 WARNING streamlit.runtime.scriptrunner_utils.script_run_context: Thread 'MainThread': missing ScriptRunContext! This warning can be ignored when running in bare mode.\n",
      "2024-10-30 10:52:39.278 WARNING streamlit.runtime.scriptrunner_utils.script_run_context: Thread 'MainThread': missing ScriptRunContext! This warning can be ignored when running in bare mode.\n",
      "2024-10-30 10:52:39.371 \n",
      "  \u001b[33m\u001b[1mWarning:\u001b[0m to view this Streamlit app on a browser, run it with the following\n",
      "  command:\n",
      "\n",
      "    streamlit run c:\\Users\\umesh\\anaconda3\\envs\\DeepLearning\\lib\\site-packages\\ipykernel_launcher.py [ARGUMENTS]\n",
      "2024-10-30 10:52:39.372 Thread 'MainThread': missing ScriptRunContext! This warning can be ignored when running in bare mode.\n"
     ]
    }
   ],
   "source": [
    "import streamlit as st\n",
    "from bokeh.models.widgets import Button\n",
    "from bokeh.models import CustomJS\n",
    "from streamlit_bokeh_events import streamlit_bokeh_events\n",
    "\n",
    "stt_button = Button(label=\"Speak\", width=100)\n",
    "\n",
    "stt_button.js_on_event(\"button_click\", CustomJS(code=\"\"\"\n",
    "    var recognition = new webkitSpeechRecognition();\n",
    "    recognition.continuous = true;\n",
    "    recognition.interimResults = true;\n",
    " \n",
    "    recognition.onresult = function (e) {\n",
    "        var value = \"\";\n",
    "        for (var i = e.resultIndex; i < e.results.length; ++i) {\n",
    "            if (e.results[i].isFinal) {\n",
    "                value += e.results[i][0].transcript;\n",
    "            }\n",
    "        }\n",
    "        if ( value != \"\") {\n",
    "            document.dispatchEvent(new CustomEvent(\"GET_TEXT\", {detail: value}));\n",
    "        }\n",
    "    }\n",
    "    recognition.start();\n",
    "    \"\"\"))\n",
    "\n",
    "result = streamlit_bokeh_events(\n",
    "    stt_button,\n",
    "    events=\"GET_TEXT\",\n",
    "    key=\"listen\",\n",
    "    refresh_on_update=False,\n",
    "    override_height=75,\n",
    "    debounce_time=0)\n",
    "\n",
    "if result:\n",
    "    if \"GET_TEXT\" in result:\n",
    "        st.write(result.get(\"GET_TEXT\"))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Requirement already satisfied: pyzmq in c:\\users\\umesh\\anaconda3\\envs\\deeplearning\\lib\\site-packages (23.2.0)\n",
      "Note: you may need to restart the kernel to use updated packages.\n"
     ]
    }
   ],
   "source": [
    "pip install pyzmq"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "DeepLearning",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.10.13"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}