Spaces:
Sleeping
Sleeping
fix warning
Browse files- Cargo.lock +191 -168
- Cargo.toml +1 -7
- src/lesson.rs +47 -20
- src/main.rs +6 -46
Cargo.lock
CHANGED
@@ -74,12 +74,6 @@ dependencies = [
|
|
74 |
"windows-sys",
|
75 |
]
|
76 |
|
77 |
-
[[package]]
|
78 |
-
name = "arrayvec"
|
79 |
-
version = "0.7.4"
|
80 |
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
81 |
-
checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711"
|
82 |
-
|
83 |
[[package]]
|
84 |
name = "async-stream"
|
85 |
version = "0.3.5"
|
@@ -99,7 +93,7 @@ checksum = "16e62a023e7c117e27523144c5d2459f4397fcc3cab0085af8e2224f643a0193"
|
|
99 |
dependencies = [
|
100 |
"proc-macro2",
|
101 |
"quote",
|
102 |
-
"syn",
|
103 |
]
|
104 |
|
105 |
[[package]]
|
@@ -110,7 +104,7 @@ checksum = "a66537f1bb974b254c98ed142ff995236e81b9d0fe4db0575f46612cb15eb0f9"
|
|
110 |
dependencies = [
|
111 |
"proc-macro2",
|
112 |
"quote",
|
113 |
-
"syn",
|
114 |
]
|
115 |
|
116 |
[[package]]
|
@@ -561,12 +555,40 @@ dependencies = [
|
|
561 |
"vsimd",
|
562 |
]
|
563 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
564 |
[[package]]
|
565 |
name = "bitflags"
|
566 |
version = "1.3.2"
|
567 |
source = "registry+https://github.com/rust-lang/crates.io-index"
|
568 |
checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
|
569 |
|
|
|
|
|
|
|
|
|
|
|
|
|
570 |
[[package]]
|
571 |
name = "block-buffer"
|
572 |
version = "0.10.4"
|
@@ -582,12 +604,6 @@ version = "3.14.0"
|
|
582 |
source = "registry+https://github.com/rust-lang/crates.io-index"
|
583 |
checksum = "7f30e7476521f6f8af1a1c4c0b8cc94f0bee37d91763d0ca2665f299b6cd8aec"
|
584 |
|
585 |
-
[[package]]
|
586 |
-
name = "bytemuck"
|
587 |
-
version = "1.14.0"
|
588 |
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
589 |
-
checksum = "374d28ec25809ee0e23827c2ab573d729e293f281dfe393500e7ad618baa61c6"
|
590 |
-
|
591 |
[[package]]
|
592 |
name = "byteorder"
|
593 |
version = "1.5.0"
|
@@ -619,12 +635,32 @@ dependencies = [
|
|
619 |
"libc",
|
620 |
]
|
621 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
622 |
[[package]]
|
623 |
name = "cfg-if"
|
624 |
version = "1.0.0"
|
625 |
source = "registry+https://github.com/rust-lang/crates.io-index"
|
626 |
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
|
627 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
628 |
[[package]]
|
629 |
name = "clap"
|
630 |
version = "4.4.6"
|
@@ -656,7 +692,7 @@ dependencies = [
|
|
656 |
"heck",
|
657 |
"proc-macro2",
|
658 |
"quote",
|
659 |
-
"syn",
|
660 |
]
|
661 |
|
662 |
[[package]]
|
@@ -747,21 +783,22 @@ version = "1.9.0"
|
|
747 |
source = "registry+https://github.com/rust-lang/crates.io-index"
|
748 |
checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07"
|
749 |
|
750 |
-
[[package]]
|
751 |
-
name = "encoding_rs"
|
752 |
-
version = "0.8.33"
|
753 |
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
754 |
-
checksum = "7268b386296a025e474d5140678f75d6de9493ae55a5d709eeb9dd08149945e1"
|
755 |
-
dependencies = [
|
756 |
-
"cfg-if",
|
757 |
-
]
|
758 |
-
|
759 |
[[package]]
|
760 |
name = "equivalent"
|
761 |
version = "1.0.1"
|
762 |
source = "registry+https://github.com/rust-lang/crates.io-index"
|
763 |
checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5"
|
764 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
765 |
[[package]]
|
766 |
name = "fastrand"
|
767 |
version = "2.0.1"
|
@@ -806,7 +843,7 @@ checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72"
|
|
806 |
dependencies = [
|
807 |
"proc-macro2",
|
808 |
"quote",
|
809 |
-
"syn",
|
810 |
]
|
811 |
|
812 |
[[package]]
|
@@ -863,6 +900,12 @@ version = "0.28.0"
|
|
863 |
source = "registry+https://github.com/rust-lang/crates.io-index"
|
864 |
checksum = "6fb8d784f27acf97159b40fc4db5ecd8aa23b9ad5ef69cdd136d3bc80665f0c0"
|
865 |
|
|
|
|
|
|
|
|
|
|
|
|
|
866 |
[[package]]
|
867 |
name = "h2"
|
868 |
version = "0.3.21"
|
@@ -946,10 +989,13 @@ dependencies = [
|
|
946 |
]
|
947 |
|
948 |
[[package]]
|
949 |
-
name = "
|
950 |
-
version = "
|
951 |
source = "registry+https://github.com/rust-lang/crates.io-index"
|
952 |
-
checksum = "
|
|
|
|
|
|
|
953 |
|
954 |
[[package]]
|
955 |
name = "http"
|
@@ -1076,12 +1122,34 @@ version = "1.4.0"
|
|
1076 |
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1077 |
checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
|
1078 |
|
|
|
|
|
|
|
|
|
|
|
|
|
1079 |
[[package]]
|
1080 |
name = "libc"
|
1081 |
version = "0.2.149"
|
1082 |
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1083 |
checksum = "a08173bc88b7955d1b3145aa561539096c421ac8debde8cbc3612ec635fee29b"
|
1084 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1085 |
[[package]]
|
1086 |
name = "lock_api"
|
1087 |
version = "0.4.11"
|
@@ -1120,6 +1188,12 @@ dependencies = [
|
|
1120 |
"unicase",
|
1121 |
]
|
1122 |
|
|
|
|
|
|
|
|
|
|
|
|
|
1123 |
[[package]]
|
1124 |
name = "miniz_oxide"
|
1125 |
version = "0.7.1"
|
@@ -1140,6 +1214,16 @@ dependencies = [
|
|
1140 |
"windows-sys",
|
1141 |
]
|
1142 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1143 |
[[package]]
|
1144 |
name = "nu-ansi-term"
|
1145 |
version = "0.46.0"
|
@@ -1235,6 +1319,12 @@ dependencies = [
|
|
1235 |
"windows-targets",
|
1236 |
]
|
1237 |
|
|
|
|
|
|
|
|
|
|
|
|
|
1238 |
[[package]]
|
1239 |
name = "percent-encoding"
|
1240 |
version = "2.3.0"
|
@@ -1258,7 +1348,7 @@ checksum = "4359fd9c9171ec6e8c62926d6faaf553a8dc3f64e1507e76da7911b4f6a04405"
|
|
1258 |
dependencies = [
|
1259 |
"proc-macro2",
|
1260 |
"quote",
|
1261 |
-
"syn",
|
1262 |
]
|
1263 |
|
1264 |
[[package]]
|
@@ -1315,7 +1405,7 @@ dependencies = [
|
|
1315 |
"proc-macro-crate",
|
1316 |
"proc-macro2",
|
1317 |
"quote",
|
1318 |
-
"syn",
|
1319 |
]
|
1320 |
|
1321 |
[[package]]
|
@@ -1327,17 +1417,15 @@ dependencies = [
|
|
1327 |
"aws-sdk-polly",
|
1328 |
"aws-sdk-transcribestreaming",
|
1329 |
"aws-sdk-translate",
|
1330 |
-
"bytes",
|
1331 |
"clap",
|
1332 |
"futures-util",
|
1333 |
-
"hound",
|
1334 |
"poem",
|
1335 |
"serde",
|
1336 |
"serde_json",
|
1337 |
-
"symphonia",
|
1338 |
"tokio",
|
1339 |
"tokio-stream",
|
1340 |
"tracing-subscriber",
|
|
|
1341 |
]
|
1342 |
|
1343 |
[[package]]
|
@@ -1416,7 +1504,7 @@ version = "0.4.1"
|
|
1416 |
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1417 |
checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa"
|
1418 |
dependencies = [
|
1419 |
-
"bitflags",
|
1420 |
]
|
1421 |
|
1422 |
[[package]]
|
@@ -1478,6 +1566,12 @@ version = "0.1.23"
|
|
1478 |
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1479 |
checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76"
|
1480 |
|
|
|
|
|
|
|
|
|
|
|
|
|
1481 |
[[package]]
|
1482 |
name = "rustc_version"
|
1483 |
version = "0.4.0"
|
@@ -1487,6 +1581,19 @@ dependencies = [
|
|
1487 |
"semver",
|
1488 |
]
|
1489 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1490 |
[[package]]
|
1491 |
name = "rustls"
|
1492 |
version = "0.21.7"
|
@@ -1567,7 +1674,7 @@ version = "2.9.2"
|
|
1567 |
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1568 |
checksum = "05b64fb303737d99b81884b2c63433e9ae28abebe5eb5045dcdd175dc2ecf4de"
|
1569 |
dependencies = [
|
1570 |
-
"bitflags",
|
1571 |
"core-foundation",
|
1572 |
"core-foundation-sys",
|
1573 |
"libc",
|
@@ -1607,7 +1714,7 @@ checksum = "1e48d1f918009ce3145511378cf68d613e3b3d9137d67272562080d68a2b32d5"
|
|
1607 |
dependencies = [
|
1608 |
"proc-macro2",
|
1609 |
"quote",
|
1610 |
-
"syn",
|
1611 |
]
|
1612 |
|
1613 |
[[package]]
|
@@ -1664,6 +1771,12 @@ dependencies = [
|
|
1664 |
"lazy_static",
|
1665 |
]
|
1666 |
|
|
|
|
|
|
|
|
|
|
|
|
|
1667 |
[[package]]
|
1668 |
name = "signal-hook-registry"
|
1669 |
version = "1.4.1"
|
@@ -1727,135 +1840,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1727 |
checksum = "81cdd64d312baedb58e21336b31bc043b77e01cc99033ce76ef539f78e965ebc"
|
1728 |
|
1729 |
[[package]]
|
1730 |
-
name = "
|
1731 |
-
version = "0.
|
1732 |
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1733 |
-
checksum = "62e48dba70095f265fdb269b99619b95d04c89e619538138383e63310b14d941"
|
1734 |
-
dependencies = [
|
1735 |
-
"lazy_static",
|
1736 |
-
"symphonia-bundle-flac",
|
1737 |
-
"symphonia-codec-adpcm",
|
1738 |
-
"symphonia-codec-pcm",
|
1739 |
-
"symphonia-codec-vorbis",
|
1740 |
-
"symphonia-core",
|
1741 |
-
"symphonia-format-mkv",
|
1742 |
-
"symphonia-format-ogg",
|
1743 |
-
"symphonia-format-wav",
|
1744 |
-
"symphonia-metadata",
|
1745 |
-
]
|
1746 |
-
|
1747 |
-
[[package]]
|
1748 |
-
name = "symphonia-bundle-flac"
|
1749 |
-
version = "0.5.3"
|
1750 |
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1751 |
-
checksum = "7f23b0482a7cb18fcdf9981ab0b78df800ef0080187d294650023c462439058d"
|
1752 |
-
dependencies = [
|
1753 |
-
"log",
|
1754 |
-
"symphonia-core",
|
1755 |
-
"symphonia-metadata",
|
1756 |
-
"symphonia-utils-xiph",
|
1757 |
-
]
|
1758 |
-
|
1759 |
-
[[package]]
|
1760 |
-
name = "symphonia-codec-adpcm"
|
1761 |
-
version = "0.5.3"
|
1762 |
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1763 |
-
checksum = "870e7dc1865d818c7b6318879d060553a73a3b2a3b8443dff90910f10ac41150"
|
1764 |
-
dependencies = [
|
1765 |
-
"log",
|
1766 |
-
"symphonia-core",
|
1767 |
-
]
|
1768 |
-
|
1769 |
-
[[package]]
|
1770 |
-
name = "symphonia-codec-pcm"
|
1771 |
-
version = "0.5.3"
|
1772 |
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1773 |
-
checksum = "47f1fbd220a06a641c8ce2ddad10f5ef6ee5cc0c54d9044d25d43b0d3119deaa"
|
1774 |
-
dependencies = [
|
1775 |
-
"log",
|
1776 |
-
"symphonia-core",
|
1777 |
-
]
|
1778 |
-
|
1779 |
-
[[package]]
|
1780 |
-
name = "symphonia-codec-vorbis"
|
1781 |
-
version = "0.5.3"
|
1782 |
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1783 |
-
checksum = "3953397e3506aa01350c4205817e4f95b58d476877a42f0458d07b665749e203"
|
1784 |
-
dependencies = [
|
1785 |
-
"log",
|
1786 |
-
"symphonia-core",
|
1787 |
-
"symphonia-utils-xiph",
|
1788 |
-
]
|
1789 |
-
|
1790 |
-
[[package]]
|
1791 |
-
name = "symphonia-core"
|
1792 |
-
version = "0.5.3"
|
1793 |
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1794 |
-
checksum = "f7c73eb88fee79705268cc7b742c7bc93a7b76e092ab751d0833866970754142"
|
1795 |
-
dependencies = [
|
1796 |
-
"arrayvec",
|
1797 |
-
"bitflags",
|
1798 |
-
"bytemuck",
|
1799 |
-
"lazy_static",
|
1800 |
-
"log",
|
1801 |
-
]
|
1802 |
-
|
1803 |
-
[[package]]
|
1804 |
-
name = "symphonia-format-mkv"
|
1805 |
-
version = "0.5.3"
|
1806 |
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1807 |
-
checksum = "f5c61dfc851ad25d4043d8c231d8617e8f7cd02a6cc0edad21ade21848d58895"
|
1808 |
-
dependencies = [
|
1809 |
-
"lazy_static",
|
1810 |
-
"log",
|
1811 |
-
"symphonia-core",
|
1812 |
-
"symphonia-metadata",
|
1813 |
-
"symphonia-utils-xiph",
|
1814 |
-
]
|
1815 |
-
|
1816 |
-
[[package]]
|
1817 |
-
name = "symphonia-format-ogg"
|
1818 |
-
version = "0.5.3"
|
1819 |
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1820 |
-
checksum = "9bf1a00ccd11452d44048a0368828040f778ae650418dbd9d8765b7ee2574c8d"
|
1821 |
-
dependencies = [
|
1822 |
-
"log",
|
1823 |
-
"symphonia-core",
|
1824 |
-
"symphonia-metadata",
|
1825 |
-
"symphonia-utils-xiph",
|
1826 |
-
]
|
1827 |
-
|
1828 |
-
[[package]]
|
1829 |
-
name = "symphonia-format-wav"
|
1830 |
-
version = "0.5.3"
|
1831 |
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1832 |
-
checksum = "da76614728fa27c003bdcdfbac51396bd8fcbf94c95fe8e62f1d2bac58ef03a4"
|
1833 |
-
dependencies = [
|
1834 |
-
"log",
|
1835 |
-
"symphonia-core",
|
1836 |
-
"symphonia-metadata",
|
1837 |
-
]
|
1838 |
-
|
1839 |
-
[[package]]
|
1840 |
-
name = "symphonia-metadata"
|
1841 |
-
version = "0.5.3"
|
1842 |
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1843 |
-
checksum = "89c3e1937e31d0e068bbe829f66b2f2bfaa28d056365279e0ef897172c3320c0"
|
1844 |
-
dependencies = [
|
1845 |
-
"encoding_rs",
|
1846 |
-
"lazy_static",
|
1847 |
-
"log",
|
1848 |
-
"symphonia-core",
|
1849 |
-
]
|
1850 |
-
|
1851 |
-
[[package]]
|
1852 |
-
name = "symphonia-utils-xiph"
|
1853 |
-
version = "0.5.3"
|
1854 |
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1855 |
-
checksum = "
|
1856 |
dependencies = [
|
1857 |
-
"
|
1858 |
-
"
|
|
|
1859 |
]
|
1860 |
|
1861 |
[[package]]
|
@@ -1886,7 +1878,7 @@ checksum = "10712f02019e9288794769fba95cd6847df9874d49d871d062172f9dd41bc4cc"
|
|
1886 |
dependencies = [
|
1887 |
"proc-macro2",
|
1888 |
"quote",
|
1889 |
-
"syn",
|
1890 |
]
|
1891 |
|
1892 |
[[package]]
|
@@ -1969,7 +1961,7 @@ checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e"
|
|
1969 |
dependencies = [
|
1970 |
"proc-macro2",
|
1971 |
"quote",
|
1972 |
-
"syn",
|
1973 |
]
|
1974 |
|
1975 |
[[package]]
|
@@ -2084,7 +2076,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7"
|
|
2084 |
dependencies = [
|
2085 |
"proc-macro2",
|
2086 |
"quote",
|
2087 |
-
"syn",
|
2088 |
]
|
2089 |
|
2090 |
[[package]]
|
@@ -2287,7 +2279,7 @@ dependencies = [
|
|
2287 |
"once_cell",
|
2288 |
"proc-macro2",
|
2289 |
"quote",
|
2290 |
-
"syn",
|
2291 |
"wasm-bindgen-shared",
|
2292 |
]
|
2293 |
|
@@ -2309,7 +2301,7 @@ checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b"
|
|
2309 |
dependencies = [
|
2310 |
"proc-macro2",
|
2311 |
"quote",
|
2312 |
-
"syn",
|
2313 |
"wasm-bindgen-backend",
|
2314 |
"wasm-bindgen-shared",
|
2315 |
]
|
@@ -2330,6 +2322,37 @@ dependencies = [
|
|
2330 |
"wasm-bindgen",
|
2331 |
]
|
2332 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2333 |
[[package]]
|
2334 |
name = "winapi"
|
2335 |
version = "0.3.9"
|
|
|
74 |
"windows-sys",
|
75 |
]
|
76 |
|
|
|
|
|
|
|
|
|
|
|
|
|
77 |
[[package]]
|
78 |
name = "async-stream"
|
79 |
version = "0.3.5"
|
|
|
93 |
dependencies = [
|
94 |
"proc-macro2",
|
95 |
"quote",
|
96 |
+
"syn 2.0.38",
|
97 |
]
|
98 |
|
99 |
[[package]]
|
|
|
104 |
dependencies = [
|
105 |
"proc-macro2",
|
106 |
"quote",
|
107 |
+
"syn 2.0.38",
|
108 |
]
|
109 |
|
110 |
[[package]]
|
|
|
555 |
"vsimd",
|
556 |
]
|
557 |
|
558 |
+
[[package]]
|
559 |
+
name = "bindgen"
|
560 |
+
version = "0.64.0"
|
561 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
562 |
+
checksum = "c4243e6031260db77ede97ad86c27e501d646a27ab57b59a574f725d98ab1fb4"
|
563 |
+
dependencies = [
|
564 |
+
"bitflags 1.3.2",
|
565 |
+
"cexpr",
|
566 |
+
"clang-sys",
|
567 |
+
"lazy_static",
|
568 |
+
"lazycell",
|
569 |
+
"log",
|
570 |
+
"peeking_take_while",
|
571 |
+
"proc-macro2",
|
572 |
+
"quote",
|
573 |
+
"regex",
|
574 |
+
"rustc-hash",
|
575 |
+
"shlex",
|
576 |
+
"syn 1.0.109",
|
577 |
+
"which",
|
578 |
+
]
|
579 |
+
|
580 |
[[package]]
|
581 |
name = "bitflags"
|
582 |
version = "1.3.2"
|
583 |
source = "registry+https://github.com/rust-lang/crates.io-index"
|
584 |
checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
|
585 |
|
586 |
+
[[package]]
|
587 |
+
name = "bitflags"
|
588 |
+
version = "2.4.1"
|
589 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
590 |
+
checksum = "327762f6e5a765692301e5bb513e0d9fef63be86bbc14528052b1cd3e6f03e07"
|
591 |
+
|
592 |
[[package]]
|
593 |
name = "block-buffer"
|
594 |
version = "0.10.4"
|
|
|
604 |
source = "registry+https://github.com/rust-lang/crates.io-index"
|
605 |
checksum = "7f30e7476521f6f8af1a1c4c0b8cc94f0bee37d91763d0ca2665f299b6cd8aec"
|
606 |
|
|
|
|
|
|
|
|
|
|
|
|
|
607 |
[[package]]
|
608 |
name = "byteorder"
|
609 |
version = "1.5.0"
|
|
|
635 |
"libc",
|
636 |
]
|
637 |
|
638 |
+
[[package]]
|
639 |
+
name = "cexpr"
|
640 |
+
version = "0.6.0"
|
641 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
642 |
+
checksum = "6fac387a98bb7c37292057cffc56d62ecb629900026402633ae9160df93a8766"
|
643 |
+
dependencies = [
|
644 |
+
"nom",
|
645 |
+
]
|
646 |
+
|
647 |
[[package]]
|
648 |
name = "cfg-if"
|
649 |
version = "1.0.0"
|
650 |
source = "registry+https://github.com/rust-lang/crates.io-index"
|
651 |
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
|
652 |
|
653 |
+
[[package]]
|
654 |
+
name = "clang-sys"
|
655 |
+
version = "1.6.1"
|
656 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
657 |
+
checksum = "c688fc74432808e3eb684cae8830a86be1d66a2bd58e1f248ed0960a590baf6f"
|
658 |
+
dependencies = [
|
659 |
+
"glob",
|
660 |
+
"libc",
|
661 |
+
"libloading",
|
662 |
+
]
|
663 |
+
|
664 |
[[package]]
|
665 |
name = "clap"
|
666 |
version = "4.4.6"
|
|
|
692 |
"heck",
|
693 |
"proc-macro2",
|
694 |
"quote",
|
695 |
+
"syn 2.0.38",
|
696 |
]
|
697 |
|
698 |
[[package]]
|
|
|
783 |
source = "registry+https://github.com/rust-lang/crates.io-index"
|
784 |
checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07"
|
785 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
786 |
[[package]]
|
787 |
name = "equivalent"
|
788 |
version = "1.0.1"
|
789 |
source = "registry+https://github.com/rust-lang/crates.io-index"
|
790 |
checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5"
|
791 |
|
792 |
+
[[package]]
|
793 |
+
name = "errno"
|
794 |
+
version = "0.3.5"
|
795 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
796 |
+
checksum = "ac3e13f66a2f95e32a39eaa81f6b95d42878ca0e1db0c7543723dfe12557e860"
|
797 |
+
dependencies = [
|
798 |
+
"libc",
|
799 |
+
"windows-sys",
|
800 |
+
]
|
801 |
+
|
802 |
[[package]]
|
803 |
name = "fastrand"
|
804 |
version = "2.0.1"
|
|
|
843 |
dependencies = [
|
844 |
"proc-macro2",
|
845 |
"quote",
|
846 |
+
"syn 2.0.38",
|
847 |
]
|
848 |
|
849 |
[[package]]
|
|
|
900 |
source = "registry+https://github.com/rust-lang/crates.io-index"
|
901 |
checksum = "6fb8d784f27acf97159b40fc4db5ecd8aa23b9ad5ef69cdd136d3bc80665f0c0"
|
902 |
|
903 |
+
[[package]]
|
904 |
+
name = "glob"
|
905 |
+
version = "0.3.1"
|
906 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
907 |
+
checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b"
|
908 |
+
|
909 |
[[package]]
|
910 |
name = "h2"
|
911 |
version = "0.3.21"
|
|
|
989 |
]
|
990 |
|
991 |
[[package]]
|
992 |
+
name = "home"
|
993 |
+
version = "0.5.5"
|
994 |
source = "registry+https://github.com/rust-lang/crates.io-index"
|
995 |
+
checksum = "5444c27eef6923071f7ebcc33e3444508466a76f7a2b93da00ed6e19f30c1ddb"
|
996 |
+
dependencies = [
|
997 |
+
"windows-sys",
|
998 |
+
]
|
999 |
|
1000 |
[[package]]
|
1001 |
name = "http"
|
|
|
1122 |
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1123 |
checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
|
1124 |
|
1125 |
+
[[package]]
|
1126 |
+
name = "lazycell"
|
1127 |
+
version = "1.3.0"
|
1128 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1129 |
+
checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55"
|
1130 |
+
|
1131 |
[[package]]
|
1132 |
name = "libc"
|
1133 |
version = "0.2.149"
|
1134 |
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1135 |
checksum = "a08173bc88b7955d1b3145aa561539096c421ac8debde8cbc3612ec635fee29b"
|
1136 |
|
1137 |
+
[[package]]
|
1138 |
+
name = "libloading"
|
1139 |
+
version = "0.7.4"
|
1140 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1141 |
+
checksum = "b67380fd3b2fbe7527a606e18729d21c6f3951633d0500574c4dc22d2d638b9f"
|
1142 |
+
dependencies = [
|
1143 |
+
"cfg-if",
|
1144 |
+
"winapi",
|
1145 |
+
]
|
1146 |
+
|
1147 |
+
[[package]]
|
1148 |
+
name = "linux-raw-sys"
|
1149 |
+
version = "0.4.10"
|
1150 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1151 |
+
checksum = "da2479e8c062e40bf0066ffa0bc823de0a9368974af99c9f6df941d2c231e03f"
|
1152 |
+
|
1153 |
[[package]]
|
1154 |
name = "lock_api"
|
1155 |
version = "0.4.11"
|
|
|
1188 |
"unicase",
|
1189 |
]
|
1190 |
|
1191 |
+
[[package]]
|
1192 |
+
name = "minimal-lexical"
|
1193 |
+
version = "0.2.1"
|
1194 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1195 |
+
checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a"
|
1196 |
+
|
1197 |
[[package]]
|
1198 |
name = "miniz_oxide"
|
1199 |
version = "0.7.1"
|
|
|
1214 |
"windows-sys",
|
1215 |
]
|
1216 |
|
1217 |
+
[[package]]
|
1218 |
+
name = "nom"
|
1219 |
+
version = "7.1.3"
|
1220 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1221 |
+
checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a"
|
1222 |
+
dependencies = [
|
1223 |
+
"memchr",
|
1224 |
+
"minimal-lexical",
|
1225 |
+
]
|
1226 |
+
|
1227 |
[[package]]
|
1228 |
name = "nu-ansi-term"
|
1229 |
version = "0.46.0"
|
|
|
1319 |
"windows-targets",
|
1320 |
]
|
1321 |
|
1322 |
+
[[package]]
|
1323 |
+
name = "peeking_take_while"
|
1324 |
+
version = "0.1.2"
|
1325 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1326 |
+
checksum = "19b17cddbe7ec3f8bc800887bab5e717348c95ea2ca0b1bf0837fb964dc67099"
|
1327 |
+
|
1328 |
[[package]]
|
1329 |
name = "percent-encoding"
|
1330 |
version = "2.3.0"
|
|
|
1348 |
dependencies = [
|
1349 |
"proc-macro2",
|
1350 |
"quote",
|
1351 |
+
"syn 2.0.38",
|
1352 |
]
|
1353 |
|
1354 |
[[package]]
|
|
|
1405 |
"proc-macro-crate",
|
1406 |
"proc-macro2",
|
1407 |
"quote",
|
1408 |
+
"syn 2.0.38",
|
1409 |
]
|
1410 |
|
1411 |
[[package]]
|
|
|
1417 |
"aws-sdk-polly",
|
1418 |
"aws-sdk-transcribestreaming",
|
1419 |
"aws-sdk-translate",
|
|
|
1420 |
"clap",
|
1421 |
"futures-util",
|
|
|
1422 |
"poem",
|
1423 |
"serde",
|
1424 |
"serde_json",
|
|
|
1425 |
"tokio",
|
1426 |
"tokio-stream",
|
1427 |
"tracing-subscriber",
|
1428 |
+
"whisper-rs",
|
1429 |
]
|
1430 |
|
1431 |
[[package]]
|
|
|
1504 |
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1505 |
checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa"
|
1506 |
dependencies = [
|
1507 |
+
"bitflags 1.3.2",
|
1508 |
]
|
1509 |
|
1510 |
[[package]]
|
|
|
1566 |
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1567 |
checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76"
|
1568 |
|
1569 |
+
[[package]]
|
1570 |
+
name = "rustc-hash"
|
1571 |
+
version = "1.1.0"
|
1572 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1573 |
+
checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2"
|
1574 |
+
|
1575 |
[[package]]
|
1576 |
name = "rustc_version"
|
1577 |
version = "0.4.0"
|
|
|
1581 |
"semver",
|
1582 |
]
|
1583 |
|
1584 |
+
[[package]]
|
1585 |
+
name = "rustix"
|
1586 |
+
version = "0.38.20"
|
1587 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1588 |
+
checksum = "67ce50cb2e16c2903e30d1cbccfd8387a74b9d4c938b6a4c5ec6cc7556f7a8a0"
|
1589 |
+
dependencies = [
|
1590 |
+
"bitflags 2.4.1",
|
1591 |
+
"errno",
|
1592 |
+
"libc",
|
1593 |
+
"linux-raw-sys",
|
1594 |
+
"windows-sys",
|
1595 |
+
]
|
1596 |
+
|
1597 |
[[package]]
|
1598 |
name = "rustls"
|
1599 |
version = "0.21.7"
|
|
|
1674 |
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1675 |
checksum = "05b64fb303737d99b81884b2c63433e9ae28abebe5eb5045dcdd175dc2ecf4de"
|
1676 |
dependencies = [
|
1677 |
+
"bitflags 1.3.2",
|
1678 |
"core-foundation",
|
1679 |
"core-foundation-sys",
|
1680 |
"libc",
|
|
|
1714 |
dependencies = [
|
1715 |
"proc-macro2",
|
1716 |
"quote",
|
1717 |
+
"syn 2.0.38",
|
1718 |
]
|
1719 |
|
1720 |
[[package]]
|
|
|
1771 |
"lazy_static",
|
1772 |
]
|
1773 |
|
1774 |
+
[[package]]
|
1775 |
+
name = "shlex"
|
1776 |
+
version = "1.2.0"
|
1777 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1778 |
+
checksum = "a7cee0529a6d40f580e7a5e6c495c8fbfe21b7b52795ed4bb5e62cdf92bc6380"
|
1779 |
+
|
1780 |
[[package]]
|
1781 |
name = "signal-hook-registry"
|
1782 |
version = "1.4.1"
|
|
|
1840 |
checksum = "81cdd64d312baedb58e21336b31bc043b77e01cc99033ce76ef539f78e965ebc"
|
1841 |
|
1842 |
[[package]]
|
1843 |
+
name = "syn"
|
1844 |
+
version = "1.0.109"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1845 |
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1846 |
+
checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237"
|
1847 |
dependencies = [
|
1848 |
+
"proc-macro2",
|
1849 |
+
"quote",
|
1850 |
+
"unicode-ident",
|
1851 |
]
|
1852 |
|
1853 |
[[package]]
|
|
|
1878 |
dependencies = [
|
1879 |
"proc-macro2",
|
1880 |
"quote",
|
1881 |
+
"syn 2.0.38",
|
1882 |
]
|
1883 |
|
1884 |
[[package]]
|
|
|
1961 |
dependencies = [
|
1962 |
"proc-macro2",
|
1963 |
"quote",
|
1964 |
+
"syn 2.0.38",
|
1965 |
]
|
1966 |
|
1967 |
[[package]]
|
|
|
2076 |
dependencies = [
|
2077 |
"proc-macro2",
|
2078 |
"quote",
|
2079 |
+
"syn 2.0.38",
|
2080 |
]
|
2081 |
|
2082 |
[[package]]
|
|
|
2279 |
"once_cell",
|
2280 |
"proc-macro2",
|
2281 |
"quote",
|
2282 |
+
"syn 2.0.38",
|
2283 |
"wasm-bindgen-shared",
|
2284 |
]
|
2285 |
|
|
|
2301 |
dependencies = [
|
2302 |
"proc-macro2",
|
2303 |
"quote",
|
2304 |
+
"syn 2.0.38",
|
2305 |
"wasm-bindgen-backend",
|
2306 |
"wasm-bindgen-shared",
|
2307 |
]
|
|
|
2322 |
"wasm-bindgen",
|
2323 |
]
|
2324 |
|
2325 |
+
[[package]]
|
2326 |
+
name = "which"
|
2327 |
+
version = "4.4.2"
|
2328 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
2329 |
+
checksum = "87ba24419a2078cd2b0f2ede2691b6c66d8e47836da3b6db8265ebad47afbfc7"
|
2330 |
+
dependencies = [
|
2331 |
+
"either",
|
2332 |
+
"home",
|
2333 |
+
"once_cell",
|
2334 |
+
"rustix",
|
2335 |
+
]
|
2336 |
+
|
2337 |
+
[[package]]
|
2338 |
+
name = "whisper-rs"
|
2339 |
+
version = "0.8.0"
|
2340 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
2341 |
+
checksum = "2c950fb18ad556b053ba615b88fd4d01ed6020be740c3371eb0fc4aec64a0639"
|
2342 |
+
dependencies = [
|
2343 |
+
"whisper-rs-sys",
|
2344 |
+
]
|
2345 |
+
|
2346 |
+
[[package]]
|
2347 |
+
name = "whisper-rs-sys"
|
2348 |
+
version = "0.6.1"
|
2349 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
2350 |
+
checksum = "094a5bd86f6f52562bbc74c28f27cd80197e54656cfb7213cf4ba37b5246cc9e"
|
2351 |
+
dependencies = [
|
2352 |
+
"bindgen",
|
2353 |
+
"cfg-if",
|
2354 |
+
]
|
2355 |
+
|
2356 |
[[package]]
|
2357 |
name = "winapi"
|
2358 |
version = "0.3.9"
|
Cargo.toml
CHANGED
@@ -3,26 +3,20 @@ name = "polyhedron"
|
|
3 |
version = "0.1.0"
|
4 |
edition = "2021"
|
5 |
|
6 |
-
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
7 |
-
|
8 |
[dependencies]
|
9 |
aws-config= { version = "0.56.1" }
|
10 |
aws-sdk-transcribestreaming= { version = "0.33.0" }
|
11 |
aws-sdk-translate = "0.33.0"
|
12 |
aws-sdk-polly = "0.33.0"
|
13 |
clap = { version = "4.4.6" , features = ["derive"]}
|
14 |
-
hound = "3.5.1"
|
15 |
tokio = { version = "1.33.0" , features = ["full"] }
|
16 |
tokio-stream = "0.1.14"
|
17 |
-
bytes = "1.0.1"
|
18 |
async-stream = "0.3.5"
|
19 |
tracing-subscriber = "0.3.17"
|
20 |
futures-util = "0.3.28"
|
21 |
-
#symphonia-codec-pcm = "0.5.3"
|
22 |
-
#symphonia-format-mkv = "0.5.3"
|
23 |
-
symphonia = { version = "0.5.3", features = ["mkv", "pcm"] }
|
24 |
serde = { version = "1.0.189", features = ["derive"] }
|
25 |
serde_json = { version = "1.0.107", features = [] }
|
|
|
26 |
|
27 |
[dependencies.poem]
|
28 |
version = "1.3.58"
|
|
|
3 |
version = "0.1.0"
|
4 |
edition = "2021"
|
5 |
|
|
|
|
|
6 |
[dependencies]
|
7 |
aws-config= { version = "0.56.1" }
|
8 |
aws-sdk-transcribestreaming= { version = "0.33.0" }
|
9 |
aws-sdk-translate = "0.33.0"
|
10 |
aws-sdk-polly = "0.33.0"
|
11 |
clap = { version = "4.4.6" , features = ["derive"]}
|
|
|
12 |
tokio = { version = "1.33.0" , features = ["full"] }
|
13 |
tokio-stream = "0.1.14"
|
|
|
14 |
async-stream = "0.3.5"
|
15 |
tracing-subscriber = "0.3.17"
|
16 |
futures-util = "0.3.28"
|
|
|
|
|
|
|
17 |
serde = { version = "1.0.189", features = ["derive"] }
|
18 |
serde_json = { version = "1.0.107", features = [] }
|
19 |
+
whisper-rs = { version = "0.8.0" , features = ["coreml"] }
|
20 |
|
21 |
[dependencies.poem]
|
22 |
version = "1.3.58"
|
src/lesson.rs
CHANGED
@@ -1,6 +1,8 @@
|
|
1 |
use std::sync::{Arc, Weak};
|
2 |
use tokio::sync::RwLock;
|
3 |
use std::collections::BTreeMap;
|
|
|
|
|
4 |
use std::io::BufRead;
|
5 |
use async_stream::stream;
|
6 |
use aws_config::SdkConfig;
|
@@ -9,13 +11,11 @@ use aws_sdk_polly::types::{Engine, OutputFormat, SpeechMarkType, VoiceId};
|
|
9 |
use aws_sdk_transcribestreaming::operation::start_stream_transcription::StartStreamTranscriptionOutput;
|
10 |
use aws_sdk_transcribestreaming::primitives::Blob;
|
11 |
use aws_sdk_transcribestreaming::types::{AudioEvent, AudioStream, LanguageCode, MediaEncoding, TranscriptResultStream};
|
12 |
-
use clap::builder::TypedValueParser;
|
13 |
use futures_util::{Stream, StreamExt, TryStreamExt};
|
14 |
use futures_util::future::try_join;
|
15 |
use serde::{Deserialize, Serialize};
|
16 |
|
17 |
-
use tokio::
|
18 |
-
use crate::StreamTranscriptionError;
|
19 |
|
20 |
#[derive(Clone, Debug)]
|
21 |
pub struct LessonsManager {
|
@@ -42,7 +42,7 @@ impl LessonsManager {
|
|
42 |
id: u32,
|
43 |
speaker_lang: LanguageCode) -> Lesson {
|
44 |
let mut map = self.lessons.write().await;
|
45 |
-
let lesson: Lesson = InnerLesson::new(self.clone(),
|
46 |
map.insert(id, lesson.clone());
|
47 |
lesson
|
48 |
}
|
@@ -101,7 +101,6 @@ impl From<InnerLesson> for Lesson {
|
|
101 |
#[derive(Debug)]
|
102 |
struct InnerLesson {
|
103 |
parent: LessonsManager,
|
104 |
-
id: u32,
|
105 |
speaker_lang: LanguageCode,
|
106 |
speaker_voice_channel: tokio::sync::mpsc::Sender<Vec<u8>>,
|
107 |
speaker_transcript: tokio::sync::broadcast::Sender<String>,
|
@@ -112,7 +111,6 @@ struct InnerLesson {
|
|
112 |
impl InnerLesson {
|
113 |
fn new(
|
114 |
parent: LessonsManager,
|
115 |
-
id: u32,
|
116 |
speaker_lang: LanguageCode
|
117 |
) -> InnerLesson {
|
118 |
let (speaker_transcript, _) = tokio::sync::broadcast::channel::<String>(128);
|
@@ -137,16 +135,16 @@ impl InnerLesson {
|
|
137 |
.audio_stream(input_stream.into())
|
138 |
.send()
|
139 |
.await
|
140 |
-
.map_err(|e|
|
141 |
|
142 |
-
let
|
143 |
output_stream
|
144 |
.try_for_each(|text| async {
|
145 |
let _ = shared_speaker_transcript.send(text);
|
146 |
Ok(())
|
147 |
})
|
148 |
.await?;
|
149 |
-
Ok(()) as Result<(),
|
150 |
};
|
151 |
select! {
|
152 |
res = fut => {
|
@@ -160,10 +158,9 @@ impl InnerLesson {
|
|
160 |
|
161 |
InnerLesson {
|
162 |
parent,
|
163 |
-
id,
|
164 |
speaker_lang,
|
165 |
speaker_voice_channel,
|
166 |
-
speaker_transcript
|
167 |
lang_lessons: RwLock::new(BTreeMap::new()),
|
168 |
drop_handler: Some(drop_handler),
|
169 |
}
|
@@ -181,12 +178,19 @@ impl Drop for InnerLesson {
|
|
181 |
|
182 |
struct InnerLangLesson {
|
183 |
parent: Lesson,
|
184 |
-
lang: String,
|
185 |
translated_tx: tokio::sync::broadcast::Sender<String>,
|
186 |
voice_lessons: RwLock<BTreeMap<VoiceId, Weak<InnerVoiceLesson>>>,
|
187 |
drop_handler: Option<tokio::sync::oneshot::Sender<Signal>>,
|
188 |
}
|
189 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
190 |
#[derive(Clone)]
|
191 |
pub(crate) struct LangLesson {
|
192 |
inner: Arc<InnerLangLesson>
|
@@ -219,7 +223,7 @@ impl LangLesson {
|
|
219 |
parent: Lesson,
|
220 |
lang: String,
|
221 |
) -> Self {
|
222 |
-
let shared_lang = lang.clone()
|
223 |
let shared_speaker_lang = parent.inner.speaker_lang.clone();
|
224 |
let (translated_tx, _) = tokio::sync::broadcast::channel::<String>(128);
|
225 |
let shared_translated_tx = translated_tx.clone();
|
@@ -245,7 +249,6 @@ impl LangLesson {
|
|
245 |
Err(e) => {
|
246 |
return Err(e);
|
247 |
}
|
248 |
-
_ => {}
|
249 |
}
|
250 |
}
|
251 |
Ok(())
|
@@ -262,7 +265,6 @@ impl LangLesson {
|
|
262 |
});
|
263 |
InnerLangLesson {
|
264 |
parent,
|
265 |
-
lang,
|
266 |
translated_tx,
|
267 |
voice_lessons: RwLock::new(BTreeMap::new()),
|
268 |
drop_handler: Some(drop_handler),
|
@@ -325,8 +327,6 @@ impl From<Arc<InnerVoiceLesson>> for VoiceLesson {
|
|
325 |
}
|
326 |
|
327 |
struct InnerVoiceLesson {
|
328 |
-
parent: LangLesson,
|
329 |
-
voice: VoiceId,
|
330 |
lip_sync_tx: tokio::sync::broadcast::Sender<Vec<Viseme>>,
|
331 |
voice_lesson: tokio::sync::broadcast::Sender<Vec<u8>>,
|
332 |
drop_handler: Option<tokio::sync::oneshot::Sender<Signal>>,
|
@@ -381,8 +381,6 @@ impl InnerVoiceLesson {
|
|
381 |
});
|
382 |
|
383 |
InnerVoiceLesson {
|
384 |
-
parent,
|
385 |
-
voice,
|
386 |
lip_sync_tx,
|
387 |
voice_lesson,
|
388 |
drop_handler: Some(tx),
|
@@ -417,7 +415,7 @@ fn to_stream(mut output: StartStreamTranscriptionOutput) -> impl Stream<Item=Res
|
|
417 |
}
|
418 |
}
|
419 |
}
|
420 |
-
|
421 |
}
|
422 |
}
|
423 |
}
|
@@ -465,3 +463,32 @@ async fn synthesize_speech(client: &aws_sdk_polly::Client,
|
|
465 |
Ok((parsed, audio.audio_stream))
|
466 |
}
|
467 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
use std::sync::{Arc, Weak};
|
2 |
use tokio::sync::RwLock;
|
3 |
use std::collections::BTreeMap;
|
4 |
+
use std::error::Error;
|
5 |
+
use std::fmt::{Display, Formatter};
|
6 |
use std::io::BufRead;
|
7 |
use async_stream::stream;
|
8 |
use aws_config::SdkConfig;
|
|
|
11 |
use aws_sdk_transcribestreaming::operation::start_stream_transcription::StartStreamTranscriptionOutput;
|
12 |
use aws_sdk_transcribestreaming::primitives::Blob;
|
13 |
use aws_sdk_transcribestreaming::types::{AudioEvent, AudioStream, LanguageCode, MediaEncoding, TranscriptResultStream};
|
|
|
14 |
use futures_util::{Stream, StreamExt, TryStreamExt};
|
15 |
use futures_util::future::try_join;
|
16 |
use serde::{Deserialize, Serialize};
|
17 |
|
18 |
+
use tokio::select;
|
|
|
19 |
|
20 |
#[derive(Clone, Debug)]
|
21 |
pub struct LessonsManager {
|
|
|
42 |
id: u32,
|
43 |
speaker_lang: LanguageCode) -> Lesson {
|
44 |
let mut map = self.lessons.write().await;
|
45 |
+
let lesson: Lesson = InnerLesson::new(self.clone(), speaker_lang).into();
|
46 |
map.insert(id, lesson.clone());
|
47 |
lesson
|
48 |
}
|
|
|
101 |
#[derive(Debug)]
|
102 |
struct InnerLesson {
|
103 |
parent: LessonsManager,
|
|
|
104 |
speaker_lang: LanguageCode,
|
105 |
speaker_voice_channel: tokio::sync::mpsc::Sender<Vec<u8>>,
|
106 |
speaker_transcript: tokio::sync::broadcast::Sender<String>,
|
|
|
111 |
impl InnerLesson {
|
112 |
fn new(
|
113 |
parent: LessonsManager,
|
|
|
114 |
speaker_lang: LanguageCode
|
115 |
) -> InnerLesson {
|
116 |
let (speaker_transcript, _) = tokio::sync::broadcast::channel::<String>(128);
|
|
|
135 |
.audio_stream(input_stream.into())
|
136 |
.send()
|
137 |
.await
|
138 |
+
.map_err(|e| StreamTranscriptionError::EstablishStreamError(Box::new(e)))?;
|
139 |
|
140 |
+
let output_stream = to_stream(output);
|
141 |
output_stream
|
142 |
.try_for_each(|text| async {
|
143 |
let _ = shared_speaker_transcript.send(text);
|
144 |
Ok(())
|
145 |
})
|
146 |
.await?;
|
147 |
+
Ok(()) as Result<(), StreamTranscriptionError>
|
148 |
};
|
149 |
select! {
|
150 |
res = fut => {
|
|
|
158 |
|
159 |
InnerLesson {
|
160 |
parent,
|
|
|
161 |
speaker_lang,
|
162 |
speaker_voice_channel,
|
163 |
+
speaker_transcript,
|
164 |
lang_lessons: RwLock::new(BTreeMap::new()),
|
165 |
drop_handler: Some(drop_handler),
|
166 |
}
|
|
|
178 |
|
179 |
struct InnerLangLesson {
|
180 |
parent: Lesson,
|
|
|
181 |
translated_tx: tokio::sync::broadcast::Sender<String>,
|
182 |
voice_lessons: RwLock<BTreeMap<VoiceId, Weak<InnerVoiceLesson>>>,
|
183 |
drop_handler: Option<tokio::sync::oneshot::Sender<Signal>>,
|
184 |
}
|
185 |
|
186 |
+
impl Drop for InnerLangLesson {
|
187 |
+
fn drop(&mut self) {
|
188 |
+
if let Some(tx) = self.drop_handler.take() {
|
189 |
+
let _ = tx.send(Signal::Stop);
|
190 |
+
}
|
191 |
+
}
|
192 |
+
}
|
193 |
+
|
194 |
#[derive(Clone)]
|
195 |
pub(crate) struct LangLesson {
|
196 |
inner: Arc<InnerLangLesson>
|
|
|
223 |
parent: Lesson,
|
224 |
lang: String,
|
225 |
) -> Self {
|
226 |
+
let shared_lang = lang.clone();
|
227 |
let shared_speaker_lang = parent.inner.speaker_lang.clone();
|
228 |
let (translated_tx, _) = tokio::sync::broadcast::channel::<String>(128);
|
229 |
let shared_translated_tx = translated_tx.clone();
|
|
|
249 |
Err(e) => {
|
250 |
return Err(e);
|
251 |
}
|
|
|
252 |
}
|
253 |
}
|
254 |
Ok(())
|
|
|
265 |
});
|
266 |
InnerLangLesson {
|
267 |
parent,
|
|
|
268 |
translated_tx,
|
269 |
voice_lessons: RwLock::new(BTreeMap::new()),
|
270 |
drop_handler: Some(drop_handler),
|
|
|
327 |
}
|
328 |
|
329 |
struct InnerVoiceLesson {
|
|
|
|
|
330 |
lip_sync_tx: tokio::sync::broadcast::Sender<Vec<Viseme>>,
|
331 |
voice_lesson: tokio::sync::broadcast::Sender<Vec<u8>>,
|
332 |
drop_handler: Option<tokio::sync::oneshot::Sender<Signal>>,
|
|
|
381 |
});
|
382 |
|
383 |
InnerVoiceLesson {
|
|
|
|
|
384 |
lip_sync_tx,
|
385 |
voice_lesson,
|
386 |
drop_handler: Some(tx),
|
|
|
415 |
}
|
416 |
}
|
417 |
}
|
418 |
+
_ => yield Err(StreamTranscriptionError::Unknown),
|
419 |
}
|
420 |
}
|
421 |
}
|
|
|
463 |
Ok((parsed, audio.audio_stream))
|
464 |
}
|
465 |
|
466 |
+
|
467 |
+
#[derive(Debug)]
|
468 |
+
enum StreamTranscriptionError {
|
469 |
+
EstablishStreamError(Box<dyn Error + Send + Sync>),
|
470 |
+
TranscriptResultStreamError(Box<dyn Error + Send + Sync>),
|
471 |
+
Unknown
|
472 |
+
}
|
473 |
+
|
474 |
+
|
475 |
+
impl Display for StreamTranscriptionError {
|
476 |
+
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
|
477 |
+
match self {
|
478 |
+
StreamTranscriptionError::EstablishStreamError(e) => write!(f, "EstablishStreamError: {}", e),
|
479 |
+
StreamTranscriptionError::TranscriptResultStreamError(e) => write!(f, "TranscriptResultStreamError: {}", e),
|
480 |
+
StreamTranscriptionError::Unknown => write!(f, "Unknown"),
|
481 |
+
}
|
482 |
+
}
|
483 |
+
}
|
484 |
+
|
485 |
+
impl Error for StreamTranscriptionError {
|
486 |
+
fn source(&self) -> Option<&(dyn Error + 'static)> {
|
487 |
+
match self {
|
488 |
+
StreamTranscriptionError::EstablishStreamError(e) => Some(e.as_ref()),
|
489 |
+
StreamTranscriptionError::TranscriptResultStreamError(e) => Some(e.as_ref()),
|
490 |
+
StreamTranscriptionError::Unknown => None,
|
491 |
+
}
|
492 |
+
}
|
493 |
+
}
|
494 |
+
|
src/main.rs
CHANGED
@@ -6,24 +6,20 @@
|
|
6 |
#![allow(clippy::result_large_err)]
|
7 |
|
8 |
use std::default::Default;
|
9 |
-
use std::error::Error;
|
10 |
-
use std::fmt::{Debug, Display, Formatter};
|
11 |
-
use std::future::Future;
|
12 |
-
use async_stream::stream;
|
13 |
use aws_config::meta::region::RegionProviderChain;
|
14 |
use aws_sdk_transcribestreaming::{config::Region, meta::PKG_VERSION};
|
15 |
use clap::Parser;
|
16 |
|
17 |
-
use poem::{
|
18 |
-
use futures_util::{
|
19 |
use poem::endpoint::{StaticFileEndpoint, StaticFilesEndpoint};
|
20 |
use poem::web::websocket::{Message, WebSocket};
|
21 |
use futures_util::stream::StreamExt;
|
22 |
use poem::web::{Data, Query};
|
23 |
|
24 |
use tokio::select;
|
25 |
-
use tokio_stream::Stream;
|
26 |
use serde::{Deserialize, Serialize};
|
|
|
27 |
use lesson::{LessonsManager};
|
28 |
use crate::lesson::Viseme;
|
29 |
|
@@ -45,13 +41,6 @@ struct Opt {
|
|
45 |
verbose: bool,
|
46 |
}
|
47 |
|
48 |
-
#[derive(Clone)]
|
49 |
-
enum ReplyEvent {
|
50 |
-
Transcribed(String),
|
51 |
-
Translated(String),
|
52 |
-
Synthesized(Vec<u8>),
|
53 |
-
}
|
54 |
-
|
55 |
#[derive(Clone)]
|
56 |
struct Context {
|
57 |
lessons_manager: LessonsManager,
|
@@ -60,6 +49,9 @@ struct Context {
|
|
60 |
#[tokio::main]
|
61 |
async fn main() -> Result<(), std::io::Error> {
|
62 |
tracing_subscriber::fmt::init();
|
|
|
|
|
|
|
63 |
|
64 |
let Opt {
|
65 |
region,
|
@@ -224,35 +216,3 @@ async fn stream_listener(ctx: Data<&Context>, query: Query<LessonListenerQuery>,
|
|
224 |
}
|
225 |
})
|
226 |
}
|
227 |
-
|
228 |
-
#[derive(Debug)]
|
229 |
-
enum StreamTranscriptionError {
|
230 |
-
EstablishStreamError(Box<dyn Error + Send + Sync>),
|
231 |
-
TranscriptResultStreamError(Box<dyn Error + Send + Sync>),
|
232 |
-
Shutdown,
|
233 |
-
Unknown
|
234 |
-
}
|
235 |
-
|
236 |
-
|
237 |
-
impl Display for StreamTranscriptionError {
|
238 |
-
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
|
239 |
-
match self {
|
240 |
-
StreamTranscriptionError::EstablishStreamError(e) => write!(f, "EstablishStreamError: {}", e),
|
241 |
-
StreamTranscriptionError::TranscriptResultStreamError(e) => write!(f, "TranscriptResultStreamError: {}", e),
|
242 |
-
StreamTranscriptionError::Shutdown => write!(f, "Shutdown"),
|
243 |
-
StreamTranscriptionError::Unknown => write!(f, "Unknown"),
|
244 |
-
}
|
245 |
-
}
|
246 |
-
}
|
247 |
-
|
248 |
-
impl Error for StreamTranscriptionError {
|
249 |
-
fn source(&self) -> Option<&(dyn Error + 'static)> {
|
250 |
-
match self {
|
251 |
-
StreamTranscriptionError::EstablishStreamError(e) => Some(e.as_ref()),
|
252 |
-
StreamTranscriptionError::TranscriptResultStreamError(e) => Some(e.as_ref()),
|
253 |
-
StreamTranscriptionError::Shutdown => None,
|
254 |
-
StreamTranscriptionError::Unknown => None,
|
255 |
-
}
|
256 |
-
}
|
257 |
-
}
|
258 |
-
|
|
|
6 |
#![allow(clippy::result_large_err)]
|
7 |
|
8 |
use std::default::Default;
|
|
|
|
|
|
|
|
|
9 |
use aws_config::meta::region::RegionProviderChain;
|
10 |
use aws_sdk_transcribestreaming::{config::Region, meta::PKG_VERSION};
|
11 |
use clap::Parser;
|
12 |
|
13 |
+
use poem::{EndpointExt, get, handler, IntoResponse, listener::TcpListener, Route, Server};
|
14 |
+
use futures_util::{SinkExt};
|
15 |
use poem::endpoint::{StaticFileEndpoint, StaticFilesEndpoint};
|
16 |
use poem::web::websocket::{Message, WebSocket};
|
17 |
use futures_util::stream::StreamExt;
|
18 |
use poem::web::{Data, Query};
|
19 |
|
20 |
use tokio::select;
|
|
|
21 |
use serde::{Deserialize, Serialize};
|
22 |
+
use whisper_rs::WhisperContext;
|
23 |
use lesson::{LessonsManager};
|
24 |
use crate::lesson::Viseme;
|
25 |
|
|
|
41 |
verbose: bool,
|
42 |
}
|
43 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
44 |
#[derive(Clone)]
|
45 |
struct Context {
|
46 |
lessons_manager: LessonsManager,
|
|
|
49 |
#[tokio::main]
|
50 |
async fn main() -> Result<(), std::io::Error> {
|
51 |
tracing_subscriber::fmt::init();
|
52 |
+
let wc = WhisperContext::new("/Users/famer.me/Downloads/ggml-base.bin");
|
53 |
+
let wc = wc.expect("failed to load whisper context");
|
54 |
+
let _ = wc.create_state().expect("failed to create state");
|
55 |
|
56 |
let Opt {
|
57 |
region,
|
|
|
216 |
}
|
217 |
})
|
218 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|