zhzluke96 commited on
Commit
b473486
1 Parent(s): 0cb7b72
CHANGELOG.md ADDED
@@ -0,0 +1,172 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Changelog
2
+
3
+ <a name="0.5.6-rc"></a>
4
+ ## 0.5.6-rc (2024-06-09)
5
+
6
+ ### Added
7
+
8
+ - ✨ 完善 enhancer [[205ebeb](https://github.com/lenML/ChatTTS-Forge/commit/205ebebeb7530c81fde7ea96c7e4c6a888a29835)]
9
+
10
+ ### Changed
11
+
12
+ - ⚡ 增强 TN [[092c1b9](https://github.com/lenML/ChatTTS-Forge/commit/092c1b94147249880198fe2ad3dfe3b209099e19)]
13
+ - ⚡ enhancer 支持 off_tqdm [[94d34d6](https://github.com/lenML/ChatTTS-Forge/commit/94d34d657fa3433dae9ff61775e0c364a6f77aff)]
14
+ - ⚡ 增加 git env [[43d9c65](https://github.com/lenML/ChatTTS-Forge/commit/43d9c65877ff68ad94716bc2e505ccc7ae8869a8)]
15
+ - ⚡ 修改webui保存文件格式 [[2da41c9](https://github.com/lenML/ChatTTS-Forge/commit/2da41c90aa81bf87403598aefaea3e0ae2e83d79)]
16
+
17
+ ### Fixed
18
+
19
+ - 🐛 fix seed context exit behavior [[d4e33c8](https://github.com/lenML/ChatTTS-Forge/commit/d4e33c8f0aabe253ce96756f907e979578c81b17)]
20
+ - 🐛 fix colab script [[687cc2c](https://github.com/lenML/ChatTTS-Forge/commit/687cc2cc97ff7e89328b747dbfcacbcd51bd5efc)]
21
+
22
+ ### Miscellaneous
23
+
24
+ - 📝 update webui document [[7f2bb22](https://github.com/lenML/ChatTTS-Forge/commit/7f2bb227027cc0eff312c37758a20916c1ebade6)]
25
+
26
+
27
+ <a name="0.5.5"></a>
28
+
29
+ ## 0.5.5 (2024-06-08)
30
+
31
+ ### Added
32
+
33
+ - ✨ add webui speaker creator [[df26549](https://github.com/lenML/ChatTTS-Forge/commit/df265490f35b2b991c395455dd2f4ad563193cef)]
34
+ - ✨ webui speaker tab and merger [[7ad71fd](https://github.com/lenML/ChatTTS-Forge/commit/7ad71fddb61f3b41b3af66d201f6105ca09539d9)]
35
+ - ✨ add enhance download script [[37adec6](https://github.com/lenML/ChatTTS-Forge/commit/37adec6de3109b3829602c7c7be06fd7247f10eb)]
36
+ - ✨ add audio enhance/denoise [[00cbc8e](https://github.com/lenML/ChatTTS-Forge/commit/00cbc8e96833fbcaf6cc224dc330908fa647f317)]
37
+ - ✅ add speakers api test [[fbe4304](https://github.com/lenML/ChatTTS-Forge/commit/fbe4304c6716fb182442d356dbe3976982ca9d2b)]
38
+ - ✅ add unit test [[e7f9385](https://github.com/lenML/ChatTTS-Forge/commit/e7f938562c1173899cc4e7330d59a8e354cafea4)]
39
+
40
+ ### Changed
41
+
42
+ - ♿ pin resemble-enhance [[b8f41f9](https://github.com/lenML/ChatTTS-Forge/commit/b8f41f90061c75ee3e09ddc6cae8d657bc67aad1)]
43
+ - ⚡ 调整 speaker 合并 step [[906ecc3](https://github.com/lenML/ChatTTS-Forge/commit/906ecc3d295d90459485cd131563ffd588914d52)]
44
+ - ♻️ SSML refactor [[6666082](https://github.com/lenML/ChatTTS-Forge/commit/6666082375c43b143d242bf425053e2ae661eb09)]
45
+ - ♻️ webui refactor [[7585282](https://github.com/lenML/ChatTTS-Forge/commit/75852822f7d9cd8b95b557e2870e5435a0932fa1)]
46
+ - ⚡ add benchmark [[ddb7670](https://github.com/lenML/ChatTTS-Forge/commit/ddb76704e5e6847bb0eeca2c0b50764a66783686)]
47
+
48
+ ### Removed
49
+
50
+ - 🔥 remove trainer [[0c80c24](https://github.com/lenML/ChatTTS-Forge/commit/0c80c2437fb8e8b231ae770205089198f4ac1c13)]
51
+
52
+ ### Fixed
53
+
54
+ - 🐛 fix warning and hf.spaces error [[f9700bb](https://github.com/lenML/ChatTTS-Forge/commit/f9700bbb1b057b2dfe4437de7cbd41a659be76c5)]
55
+ - 🐛 fix model thread competition [[0ade6ac](https://github.com/lenML/ChatTTS-Forge/commit/0ade6ac07a2c75eb1cdda1c3db8bdf9bc2665244)]
56
+ - 🐛 fix hf space error &#x60;ZeroGPU has not been initialized&#x60; [[562e17c](https://github.com/lenML/ChatTTS-Forge/commit/562e17c9372278c03705ec5a3ec77750854d5c7e)]
57
+ - 🐛 fix openai api [[49088c5](https://github.com/lenML/ChatTTS-Forge/commit/49088c5480043518bb9beda817f5e5b38d133fa8)]
58
+
59
+ ### Miscellaneous
60
+
61
+ - 🐳 fix pip requirements [[4256371](https://github.com/lenML/ChatTTS-Forge/commit/4256371c9d3d8d290840a98fb6ac7bc19268a1e7)]
62
+
63
+ <a name="0.5.2"></a>
64
+
65
+ ## 0.5.2 (2024-06-06)
66
+
67
+ ### Changed
68
+
69
+ - ⚡ improve TN [[6744323](https://github.com/lenML/ChatTTS-Forge/commit/6744323df814430b2d92c3f16329ab8f09eb4ad3)]
70
+
71
+ ### Fixed
72
+
73
+ - 🐛 fix window proxy env [[d0f9760](https://github.com/lenML/ChatTTS-Forge/commit/d0f97608cef2afdbeb803c906a71e05dbf2424a1)]
74
+
75
+ ### Miscellaneous
76
+
77
+ - 📝 add banchmark [[3a72ba0](https://github.com/lenML/ChatTTS-Forge/commit/3a72ba0f97d5409502b9ff98e356f69affcce06b)]
78
+
79
+ <a name="0.5.1"></a>
80
+
81
+ ## 0.5.1 (2024-06-06)
82
+
83
+ ### Fixed
84
+
85
+ - 🐛 fix SynthesizeSegments seed [[83b63bd](https://github.com/lenML/ChatTTS-Forge/commit/83b63bdd0d92e115c9b6946f427343c48de1a313)]
86
+
87
+ <a name="0.5.0"></a>
88
+
89
+ ## 0.5.0 (2024-06-06)
90
+
91
+ ### Added
92
+
93
+ - ✨ add systeam versions info [[ff94763](https://github.com/lenML/ChatTTS-Forge/commit/ff947636c5e69d6bdf5111f95d8afb979d157fba)]
94
+ - ✨ torch_gc [[d8a8f35](https://github.com/lenML/ChatTTS-Forge/commit/d8a8f35958c25d931ce47b53730d388a71e86b2d)]
95
+ - ✨ normalize improve [[c9db440](https://github.com/lenML/ChatTTS-Forge/commit/c9db440b2719119285c6536c2c4658afdb20ff27)]
96
+ - ✨ improve playground speaker manager [[01ebda3](https://github.com/lenML/ChatTTS-Forge/commit/01ebda3a28cfc5f1e78f8a434b1077f01b22f399)]
97
+ - ✨ improve speaker manager [[1b377d4](https://github.com/lenML/ChatTTS-Forge/commit/1b377d448214e232d477bd828fca5eba6aa87e7b)]
98
+ - ✨ add speakers [[6c4aa29](https://github.com/lenML/ChatTTS-Forge/commit/6c4aa29f147942d1c2f3c095b4d832409e53e5cb)]
99
+ - ✨ playground preact -&gt; react [[450a0f9](https://github.com/lenML/ChatTTS-Forge/commit/450a0f9d184c8c5d8df6cce3d8e4596c543dbfe1)]
100
+ - ✨ batch_size in api [[616a262](https://github.com/lenML/ChatTTS-Forge/commit/616a262012d1e23dd877bbfc4cde4f16f477d1a7)]
101
+ - ✨ add .env file [[a0eddee](https://github.com/lenML/ChatTTS-Forge/commit/a0eddeefc141630d43496881e73d5fcd90742828)]
102
+ - ✨ improve sentence spliter for markdown [[7cac79a](https://github.com/lenML/ChatTTS-Forge/commit/7cac79ad6720c98bdec0903dd473de70bdcef137)]
103
+ - ✨ support batch generate [[cb9d9aa](https://github.com/lenML/ChatTTS-Forge/commit/cb9d9aa5d55482a51018a4ebe95d84d95d803cc4)]
104
+ - ✨ add cli args, off_tqdm / half [[dff2098](https://github.com/lenML/ChatTTS-Forge/commit/dff2098b76deac30d738ce05ba99225914b781a3)]
105
+ - ✨ add cli args, no_playground no_docs [[98629a2](https://github.com/lenML/ChatTTS-Forge/commit/98629a2c46a376a3955ea8862c9b80361f44f8a3)]
106
+ - ✨ colab script [[5943fd9](https://github.com/lenML/ChatTTS-Forge/commit/5943fd9c168ad98c0d2caf6deffb1d63848d75c3)]
107
+ - ✨ emoji normalize [[c88fc3f](https://github.com/lenML/ChatTTS-Forge/commit/c88fc3f18f0ae512f477880cfea972376f825ab7)]
108
+ - ✨ improve webui [[c48c227](https://github.com/lenML/ChatTTS-Forge/commit/c48c2278d8a123694ecf9deeb36ea4d5e3a0499e)]
109
+ - ✨ add download models script [[581f278](https://github.com/lenML/ChatTTS-Forge/commit/581f27859dad4a6c3d1b4af9ebc854fc2f4829df)]
110
+ - ✨ add spks [[d2a7364](https://github.com/lenML/ChatTTS-Forge/commit/d2a736485907490e1dbf0db334ec2b6459d35dbe)]
111
+ - ✨ add dockerfile [[fc0f4e7](https://github.com/lenML/ChatTTS-Forge/commit/fc0f4e73f7f8e1698afd97065a84161f7807e655)]
112
+ - ✨ add ssml example / fix ssml [[a2c18b1](https://github.com/lenML/ChatTTS-Forge/commit/a2c18b149584137d323d14f0923a6c2f98969e89)]
113
+ - ✨ add styles [[e106b1b](https://github.com/lenML/ChatTTS-Forge/commit/e106b1bc3edffd71c8da8408e57444b50c0cc91a)]
114
+ - ✨ webui [[3c959ad](https://github.com/lenML/ChatTTS-Forge/commit/3c959ad341775e335233e6dd6797bca045ec106e)]
115
+ - 🎉 base code all in one [[3051588](https://github.com/lenML/ChatTTS-Forge/commit/30515881b31a5bb7b08be273f4cdb3c9a9854a6c)]
116
+
117
+ ### Changed
118
+
119
+ - ⚡ docker [[6b8eed1](https://github.com/lenML/ChatTTS-Forge/commit/6b8eed1caa69af9787a019fb226d25a155ca58af)]
120
+ - ⚡ playground improve [[f8da40b](https://github.com/lenML/ChatTTS-Forge/commit/f8da40b773d4485f69dfd207fc33294dfac61b93)]
121
+ - ⚡ improve normalize for EN [[3717ae3](https://github.com/lenML/ChatTTS-Forge/commit/3717ae31478f561f9dd83fad8983282e7f9380c9)]
122
+ - ⚡ dockerfile [[8ad7659](https://github.com/lenML/ChatTTS-Forge/commit/8ad7659f62af5436545da239ee8f8f7cb3d6c103)]
123
+ - ⚡ improve webui [[4ac24e8](https://github.com/lenML/ChatTTS-Forge/commit/4ac24e835ca078ca09f81e41980757a84cc4fccd)]
124
+ - ⚡ improve [[153fa4f](https://github.com/lenML/ChatTTS-Forge/commit/153fa4f152b3ed084cb2b5e6f0b12d86f40f77f3)]
125
+ - ⚡ improve [[2dbc76d](https://github.com/lenML/ChatTTS-Forge/commit/2dbc76ddc9937d2df63106f77197fa28a5b0d23b)]
126
+
127
+ ### Fixed
128
+
129
+ - 🐛 fix playground package url [[cc33013](https://github.com/lenML/ChatTTS-Forge/commit/cc33013a5a0a4c7f21011e44dbc0fb29228482fa)]
130
+ - 🐛 fix webui TN [[9f1e8f4](https://github.com/lenML/ChatTTS-Forge/commit/9f1e8f45dce8f519526896df7033fbc40690abeb)]
131
+ - 🐛 improve rng [#11](https://github.com/lenML/ChatTTS-Forge/issues/11) [[af06646](https://github.com/lenML/ChatTTS-Forge/commit/af06646877f56ea458a8b316dca4160d546bb4b5)]
132
+ - 🐛 fix webui segment limit [[a74034f](https://github.com/lenML/ChatTTS-Forge/commit/a74034f0fb86a997d621605967ceca59351f2627)]
133
+ - 🐛 fix speaker hash [[bd3e532](https://github.com/lenML/ChatTTS-Forge/commit/bd3e5324cf260ce75997a2b5d087af7d0c0106fe)]
134
+ - 🐛 修复 openai api speed 验证 [[124a430](https://github.com/lenML/ChatTTS-Forge/commit/124a4309e7be0e146379e175eb9cde6374ea207d)]
135
+ - 🐛 fix 接口地址调整 + 文档 [#9](https://github.com/lenML/ChatTTS-Forge/issues/9) [[3bf349e](https://github.com/lenML/ChatTTS-Forge/commit/3bf349e274d8ab343688d2d76bd59edd29c742ed)]
136
+ - 🐛 fix docker python env &#x60;unsupported operand type(s)&#x60; [[c2c9658](https://github.com/lenML/ChatTTS-Forge/commit/c2c965890334736ae0887c214fd731426239c3e8)]
137
+ - 🐛 fix webui ssml [[f2722e3](https://github.com/lenML/ChatTTS-Forge/commit/f2722e38a00cfd03cb44589d30148ecea6703cd5)]
138
+ - 🐛 fix batch window rolling [[63434b3](https://github.com/lenML/ChatTTS-Forge/commit/63434b34ab35d77dd91e6d6c244477459a8bf44f)]
139
+ - 🐛 fix colab error [[61121e9](https://github.com/lenML/ChatTTS-Forge/commit/61121e9c7150d64d5a3112e9e266eecc764c3e63)]
140
+ - 🐛 find speaker by name [[25610b8](https://github.com/lenML/ChatTTS-Forge/commit/25610b877c12bf68fd16064489c7d24354a1d900)]
141
+ - 🐛 fix dropdown miss [[e5eab54](https://github.com/lenML/ChatTTS-Forge/commit/e5eab54454069a4f7575ceee29a36960b916e015)]
142
+ - 🐛 fix env read [[f9cb9d0](https://github.com/lenML/ChatTTS-Forge/commit/f9cb9d099bd022635fe078155598411fdd7df00e)]
143
+ - 🐛 fix env loader [[d724659](https://github.com/lenML/ChatTTS-Forge/commit/d724659389197637f152b09079a36f6b1f26e79b)]
144
+ - 🐛 fix colab no half [[dce20c8](https://github.com/lenML/ChatTTS-Forge/commit/dce20c8e1592cce2871953a42f7ebfa7b0f0f54e)]
145
+ - 🐛 fix tqdm referenced [[c29fd5c](https://github.com/lenML/ChatTTS-Forge/commit/c29fd5ca82923fa1be0de70137f4ce0e2e32f4ae)]
146
+ - 🐛 fix [#6](https://github.com/lenML/ChatTTS-Forge/issues/6) [[fc30977](https://github.com/lenML/ChatTTS-Forge/commit/fc309774a73c3c9ae4c5c527c3aa9bef4a7a3c1f)]
147
+ - 🐛 fix seed context error [[faceb2b](https://github.com/lenML/ChatTTS-Forge/commit/faceb2b0af749a869df3656dee89b20f69b130b8)]
148
+ - 🐛 fix infer_seed range [[2782182](https://github.com/lenML/ChatTTS-Forge/commit/2782182367faef932429e2a7a012f7d867c0cb3a)]
149
+ - 🐛 fix [#2](https://github.com/lenML/ChatTTS-Forge/issues/2) 改用境内 cdn [[6ba27c3](https://github.com/lenML/ChatTTS-Forge/commit/6ba27c3c4d1ef4175cfe95de671599f64572eaeb)]
150
+ - 🐛 fix [#3](https://github.com/lenML/ChatTTS-Forge/issues/3) [[7ffe91f](https://github.com/lenML/ChatTTS-Forge/commit/7ffe91fa3028f88f0414786dd669b91cce409043)]
151
+ - 🐛 fix webui [[b44156f](https://github.com/lenML/ChatTTS-Forge/commit/b44156fbac7ea59765ced4bbfd303f3095166693)]
152
+ - 🐛 fix webui [[4ad0cee](https://github.com/lenML/ChatTTS-Forge/commit/4ad0ceef9d1251437cff57e12a0a82f1cd427e17)]
153
+ - 🐛 适配大写 % [[5de4bf7](https://github.com/lenML/ChatTTS-Forge/commit/5de4bf7e19d436c93bc584af859fc5e58596f0c9)]
154
+ - 🐛 webui normalize [[d8113f8](https://github.com/lenML/ChatTTS-Forge/commit/d8113f8c336d4a1b8e8fb0e82d0ba2ed02a36086)]
155
+ - 🐛 webui spk style fix [[3319358](https://github.com/lenML/ChatTTS-Forge/commit/3319358a0c51930cca6cc6c9326a694aff15c8c4)]
156
+ - 🐛 speaker load [[588848d](https://github.com/lenML/ChatTTS-Forge/commit/588848d30fa4e3fc669ced81d780517145be3e2e)]
157
+ - 🐛 speaker load [[3f63aa7](https://github.com/lenML/ChatTTS-Forge/commit/3f63aa76911274ddf62c47298d1758b0fd984e52)]
158
+ - 🐛 playground base_url [[8b468fc](https://github.com/lenML/ChatTTS-Forge/commit/8b468fc67e6c4b649844a419b8dda77bf01ea439)]
159
+
160
+ ### Miscellaneous
161
+
162
+ - :zep: improve cache [[eedc558](https://github.com/lenML/ChatTTS-Forge/commit/eedc55880f4802ef9f23117d8266100be18cbe41)]
163
+ - :zep: Improved device support [[400afe6](https://github.com/lenML/ChatTTS-Forge/commit/400afe60c9261247998617b2943fa210230b7ad3)]
164
+ - :zep: improve TN [[c22591f](https://github.com/lenML/ChatTTS-Forge/commit/c22591ffb2c1ae9e14eef307d708925bcc7a67a7)]
165
+ - add mps support [[6983506](https://github.com/lenML/ChatTTS-Forge/commit/6983506d7237c05ea346fdbe7d042b69d3743a3b)]
166
+ - :zep: revert infer_utils [[4a507cc](https://github.com/lenML/ChatTTS-Forge/commit/4a507cccf23b94a11f470b67d96bbad6c9efbf74)]
167
+ - Optimize tqdm display [[516eca6](https://github.com/lenML/ChatTTS-Forge/commit/516eca6c99b7b8433d1cda8435a19214eb1cc678)]
168
+ - Improve code [[0e278ab](https://github.com/lenML/ChatTTS-Forge/commit/0e278ab40276e3e0610515bf0e4329c95a67e00c)]
169
+ - Add apple gpu mps backend [[9764e23](https://github.com/lenML/ChatTTS-Forge/commit/9764e233e1e82d8dbec607032744cb565b616525)]
170
+ - Update issue templates [[1d19417](https://github.com/lenML/ChatTTS-Forge/commit/1d194177ab6dd3b1055ca925bfd2befc6fe2f07c)]
171
+ - LICENSE [[0afb189](https://github.com/lenML/ChatTTS-Forge/commit/0afb189718797e0706ba64c1e8d2188c4fa0fe4c)]
172
+ - Initial commit [[9fed2b6](https://github.com/lenML/ChatTTS-Forge/commit/9fed2b60a90547286e6c06483167c397c7bbed78)]
modules/normalization.py CHANGED
@@ -310,6 +310,10 @@ State-of-the-art Machine Learning for PyTorch, TensorFlow, and JAX.
310
  🗣️ Audio: automatic speech recognition and audio classification.
311
  🐙 Multimodal: table question answering, optical character recognition, information extraction from scanned documents, video classification, and visual question answering.
312
  """,
 
 
 
 
313
  ]
314
 
315
  for i, test_case in enumerate(test_cases):
 
310
  🗣️ Audio: automatic speech recognition and audio classification.
311
  🐙 Multimodal: table question answering, optical character recognition, information extraction from scanned documents, video classification, and visual question answering.
312
  """,
313
+ """
314
+ 120米
315
+ 有12%的概率会下雨
316
+ """,
317
  ]
318
 
319
  for i, test_case in enumerate(test_cases):
modules/repos_static/resemble_enhance/inference.py CHANGED
@@ -10,6 +10,8 @@ from tqdm import trange
10
 
11
  from .hparams import HParams
12
 
 
 
13
  logger = logging.getLogger(__name__)
14
 
15
 
@@ -120,7 +122,12 @@ def remove_weight_norm_recursively(module):
120
  pass
121
 
122
 
123
- def inference(model, dwav, sr, device, chunk_seconds: float = 30.0, overlap_seconds: float = 1.0):
 
 
 
 
 
124
  remove_weight_norm_recursively(model)
125
 
126
  hp: HParams = model.hp
@@ -150,7 +157,9 @@ def inference(model, dwav, sr, device, chunk_seconds: float = 30.0, overlap_seco
150
 
151
  chunks = []
152
  for start in trange(0, dwav.shape[-1], hop_length):
153
- chunks.append(inference_chunk(model, dwav[start : start + chunk_length], sr, device))
 
 
154
 
155
  hwav = merge_chunks(chunks, chunk_length, hop_length, sr=sr, length=dwav.shape[-1])
156
 
@@ -158,6 +167,8 @@ def inference(model, dwav, sr, device, chunk_seconds: float = 30.0, overlap_seco
158
  torch.cuda.synchronize()
159
 
160
  elapsed_time = time.perf_counter() - start_time
161
- logger.info(f"Elapsed time: {elapsed_time:.3f} s, {hwav.shape[-1] / elapsed_time / 1000:.3f} kHz")
 
 
162
 
163
  return hwav, sr
 
10
 
11
  from .hparams import HParams
12
 
13
+ from modules import config
14
+
15
  logger = logging.getLogger(__name__)
16
 
17
 
 
122
  pass
123
 
124
 
125
+ def inference(
126
+ model, dwav, sr, device, chunk_seconds: float = 30.0, overlap_seconds: float = 1.0
127
+ ):
128
+ if config.runtime_env_vars.off_tqdm:
129
+ trange = range
130
+
131
  remove_weight_norm_recursively(model)
132
 
133
  hp: HParams = model.hp
 
157
 
158
  chunks = []
159
  for start in trange(0, dwav.shape[-1], hop_length):
160
+ chunks.append(
161
+ inference_chunk(model, dwav[start : start + chunk_length], sr, device)
162
+ )
163
 
164
  hwav = merge_chunks(chunks, chunk_length, hop_length, sr=sr, length=dwav.shape[-1])
165
 
 
167
  torch.cuda.synchronize()
168
 
169
  elapsed_time = time.perf_counter() - start_time
170
+ logger.info(
171
+ f"Elapsed time: {elapsed_time:.3f} s, {hwav.shape[-1] / elapsed_time / 1000:.3f} kHz"
172
+ )
173
 
174
  return hwav, sr
modules/utils/zh_normalization/num.py CHANGED
@@ -46,10 +46,15 @@ def replace_frac(match) -> str:
46
  sign = match.group(1)
47
  nominator = match.group(2)
48
  denominator = match.group(3)
49
- sign: str = "负" if sign else ""
50
- nominator: str = num2str(nominator)
51
- denominator: str = num2str(denominator)
52
- result = f"{sign}{denominator}分之{nominator}"
 
 
 
 
 
53
  return result
54
 
55
 
@@ -66,9 +71,14 @@ def replace_percentage(match) -> str:
66
  """
67
  sign = match.group(1)
68
  percent = match.group(2)
69
- sign: str = "负" if sign else ""
70
- percent: str = num2str(percent)
71
- result = f"{sign}百分之{percent}"
 
 
 
 
 
72
  return result
73
 
74
 
@@ -86,9 +96,14 @@ def replace_negative_num(match) -> str:
86
  """
87
  sign = match.group(1)
88
  number = match.group(2)
89
- sign: str = "负" if sign else ""
90
- number: str = num2str(number)
91
- result = f"{sign}{number}"
 
 
 
 
 
92
  return result
93
 
94
 
@@ -105,7 +120,12 @@ def replace_default_num(match):
105
  str
106
  """
107
  number = match.group(0)
108
- return verbalize_digit(number, alt_one=True)
 
 
 
 
 
109
 
110
 
111
  # 数字表达式
@@ -144,9 +164,10 @@ def replace_number(match) -> str:
144
  sign = match.group(1)
145
  number = match.group(2)
146
  pure_decimal = match.group(5)
147
-
148
  # TODO 也许可以把 num2str 完全替换成 cn2an
149
  import cn2an
 
150
  text = pure_decimal if pure_decimal else f"{sign}{number}"
151
  try:
152
  result = cn2an.an2cn(text, "low")
@@ -158,8 +179,6 @@ def replace_number(match) -> str:
158
  number: str = num2str(number)
159
  result = f"{sign}{number}"
160
  return result
161
-
162
-
163
 
164
 
165
  # 范围表达式
 
46
  sign = match.group(1)
47
  nominator = match.group(2)
48
  denominator = match.group(3)
49
+ try:
50
+ import cn2an
51
+
52
+ return cn2an.an2cn(f"{sign}{nominator}/{denominator}", "low")
53
+ except:
54
+ sign: str = "负" if sign else ""
55
+ nominator: str = num2str(nominator)
56
+ denominator: str = num2str(denominator)
57
+ result = f"{sign}{denominator}分之{nominator}"
58
  return result
59
 
60
 
 
71
  """
72
  sign = match.group(1)
73
  percent = match.group(2)
74
+ try:
75
+ import cn2an
76
+
77
+ return cn2an.an2cn(f"{sign}{percent}%", "low")
78
+ except:
79
+ sign: str = "负" if sign else ""
80
+ percent: str = num2str(percent)
81
+ result = f"{sign}百分之{percent}"
82
  return result
83
 
84
 
 
96
  """
97
  sign = match.group(1)
98
  number = match.group(2)
99
+ try:
100
+ import cn2an
101
+
102
+ return cn2an.an2cn(f"{sign}{number}", "low")
103
+ except:
104
+ sign: str = "负" if sign else ""
105
+ number: str = num2str(number)
106
+ result = f"{sign}{number}"
107
  return result
108
 
109
 
 
120
  str
121
  """
122
  number = match.group(0)
123
+ try:
124
+ import cn2an
125
+
126
+ return cn2an.an2cn(number, "low")
127
+ except:
128
+ return verbalize_digit(number, alt_one=True)
129
 
130
 
131
  # 数字表达式
 
164
  sign = match.group(1)
165
  number = match.group(2)
166
  pure_decimal = match.group(5)
167
+
168
  # TODO 也许可以把 num2str 完全替换成 cn2an
169
  import cn2an
170
+
171
  text = pure_decimal if pure_decimal else f"{sign}{number}"
172
  try:
173
  result = cn2an.an2cn(text, "low")
 
179
  number: str = num2str(number)
180
  result = f"{sign}{number}"
181
  return result
 
 
182
 
183
 
184
  # 范围表达式
modules/webui/app.py CHANGED
@@ -7,6 +7,7 @@ import gradio as gr
7
  from modules import config
8
  from modules.webui import webui_config
9
 
 
10
  from modules.webui.system_tab import create_system_tab
11
  from modules.webui.tts_tab import create_tts_interface
12
  from modules.webui.ssml_tab import create_ssml_interface
@@ -101,7 +102,11 @@ def create_interface():
101
  create_system_tab()
102
 
103
  with gr.TabItem("README"):
104
- create_readme_tab()
 
 
 
 
105
 
106
  create_app_footer()
107
  return demo
 
7
  from modules import config
8
  from modules.webui import webui_config
9
 
10
+ from modules.webui.changelog_tab import create_changelog_tab
11
  from modules.webui.system_tab import create_system_tab
12
  from modules.webui.tts_tab import create_tts_interface
13
  from modules.webui.ssml_tab import create_ssml_interface
 
102
  create_system_tab()
103
 
104
  with gr.TabItem("README"):
105
+ with gr.Tabs():
106
+ with gr.TabItem("readme"):
107
+ create_readme_tab()
108
+ with gr.TabItem("changelog"):
109
+ create_changelog_tab()
110
 
111
  create_app_footer()
112
  return demo
modules/webui/changelog_tab.py ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+
3
+
4
+ def read_local_changelog():
5
+ with open("CHANGELOG.md", "r", encoding="utf-8") as file:
6
+ content = file.read()
7
+ content = content[content.index("# ") :]
8
+ return content
9
+
10
+
11
+ def create_changelog_tab():
12
+ changelog_content = read_local_changelog()
13
+ gr.Markdown(changelog_content)