Spaces:
Running
Running
Update main.ts
Browse files
main.ts
CHANGED
@@ -249,19 +249,8 @@ async function handleDemoRequest(req: Request) {
|
|
249 |
><textarea id="inputText">Привет, хочешь я расскажу сказку?</textarea>
|
250 |
</div>
|
251 |
<div class="dropdown-container">
|
252 |
-
<label for="voiceSelect"
|
253 |
-
<select id="voiceSelect">
|
254 |
-
<option value="ava">ava</option>
|
255 |
-
<option value="andrew">andrew</option>
|
256 |
-
<option value="emma">emma</option>
|
257 |
-
<option value="brian">brian</option>
|
258 |
-
<option value="vivienne">vivienne</option>
|
259 |
-
<option value="remy">remy</option>
|
260 |
-
<option value="seraphina">seraphina</option>
|
261 |
-
<option value="florian">florian</option>
|
262 |
-
<option value="dmitry">dmitry</option>
|
263 |
-
<option value="svetlana">svetlana</option>
|
264 |
-
</select>
|
265 |
</div>
|
266 |
<button id="synthesizeButton">синтезировать</button>
|
267 |
</div>
|
@@ -271,7 +260,8 @@ async function handleDemoRequest(req: Request) {
|
|
271 |
</div>
|
272 |
<script>
|
273 |
let audio = null;
|
274 |
-
|
|
|
275 |
document.getElementById('synthesizeButton').addEventListener('click', () => {
|
276 |
const text = document.getElementById('inputText').value || 'приветик! давай поболтаем немного?';
|
277 |
const rate = '0.0';
|
@@ -333,6 +323,25 @@ async function handleDemoRequest(req: Request) {
|
|
333 |
pitchSlider.oninput = function() {
|
334 |
pitchValue.innerHTML = this.value;
|
335 |
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
336 |
</script>
|
337 |
</body></html>`;
|
338 |
|
|
|
249 |
><textarea id="inputText">Привет, хочешь я расскажу сказку?</textarea>
|
250 |
</div>
|
251 |
<div class="dropdown-container">
|
252 |
+
<label for="voiceSelect">выберите голос:</label>
|
253 |
+
<select id="voiceSelect"></select>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
254 |
</div>
|
255 |
<button id="synthesizeButton">синтезировать</button>
|
256 |
</div>
|
|
|
260 |
</div>
|
261 |
<script>
|
262 |
let audio = null;
|
263 |
+
const modelsResponse = await fetch('/v1/audio/models');
|
264 |
+
const models = await modelsResponse.json();
|
265 |
document.getElementById('synthesizeButton').addEventListener('click', () => {
|
266 |
const text = document.getElementById('inputText').value || 'приветик! давай поболтаем немного?';
|
267 |
const rate = '0.0';
|
|
|
323 |
pitchSlider.oninput = function() {
|
324 |
pitchValue.innerHTML = this.value;
|
325 |
};
|
326 |
+
async function fetchModels() {
|
327 |
+
try {
|
328 |
+
const response = await fetch('/v1/audio/models');
|
329 |
+
const models = await response.json();
|
330 |
+
const voiceSelect = document.getElementById('voiceSelect');
|
331 |
+
|
332 |
+
models.forEach(model => {
|
333 |
+
const option = document.createElement('option');
|
334 |
+
option.value = model.model;
|
335 |
+
option.textContent = model.model;
|
336 |
+
voiceSelect.appendChild(option);
|
337 |
+
});
|
338 |
+
} catch (error) {
|
339 |
+
console.error('Ошибка при получении списка моделей:', error);
|
340 |
+
}
|
341 |
+
}
|
342 |
+
|
343 |
+
|
344 |
+
fetchModels();
|
345 |
</script>
|
346 |
</body></html>`;
|
347 |
|