Spaces:
Running
Running
Update main.ts
Browse files
main.ts
CHANGED
@@ -273,7 +273,7 @@ async function handleDemoRequest(req: Request) {
|
|
273 |
});
|
274 |
|
275 |
});
|
276 |
-
|
277 |
async function fetchModels() {
|
278 |
try {
|
279 |
const response = await fetch('/v1/audio/models');
|
@@ -291,29 +291,29 @@ async function handleDemoRequest(req: Request) {
|
|
291 |
}
|
292 |
}
|
293 |
fetchModels();
|
|
|
294 |
function createApiExamples() {
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
Example curl request:
|
311 |
-
curl '${currentUrl}/v1/audio/speech' -H 'content-type: application/json' --data-raw '{"model":"remy","input":"привет","voice":"rate:0|pitch:0"}' -o voice.mp3
|
312 |
-
\`;
|
313 |
|
314 |
-
|
315 |
-
|
316 |
-
|
|
|
|
|
|
|
317 |
</script>
|
318 |
</body></html>`;
|
319 |
|
@@ -324,8 +324,7 @@ async function handleDemoRequest(req: Request) {
|
|
324 |
|
325 |
async function handleVoiceList() {
|
326 |
let voices = [{model: 'ava', gender: 'female'}, {model: 'andrew', gender: 'male'}, {model: 'emma', gender: 'female'}, {model: 'brian', gender: 'male'}, {model: 'vivienne', gender: 'female'}, {model: 'remy', gender: 'male'}, {
|
327 |
-
model: 'seraphina',
|
328 |
-
gender: 'female'
|
329 |
}, {model: 'florian', gender: 'male'}, {model: 'dmitry', gender: 'male'}, {model: 'svetlana', gender: 'female'}];
|
330 |
|
331 |
const sortedVoiceList = voices.sort((a, b) => {
|
|
|
273 |
});
|
274 |
|
275 |
});
|
276 |
+
|
277 |
async function fetchModels() {
|
278 |
try {
|
279 |
const response = await fetch('/v1/audio/models');
|
|
|
291 |
}
|
292 |
}
|
293 |
fetchModels();
|
294 |
+
|
295 |
function createApiExamples() {
|
296 |
+
const apiExamples = document.getElementById('apiExamples');
|
297 |
+
const currentUrl = window.location.origin;
|
298 |
+
|
299 |
+
const examples = \`
|
300 |
+
GET \${currentUrl}/v1/audio/models
|
301 |
+
Returns a list of available models.
|
302 |
+
|
303 |
+
POST \${currentUrl}/v1/audio/speech
|
304 |
+
Request body example:
|
305 |
+
{
|
306 |
+
"model": "remy",
|
307 |
+
"input": "привет",
|
308 |
+
"voice": "rate:0|pitch:0"
|
309 |
+
}
|
|
|
|
|
|
|
|
|
310 |
|
311 |
+
Example curl request:
|
312 |
+
curl '\${currentUrl}/v1/audio/speech' -H 'content-type: application/json' --data-raw '{"model":"remy","input":"привет","voice":"rate:0|pitch:0"}' -o voice.mp3
|
313 |
+
\`;
|
314 |
+
|
315 |
+
apiExamples.textContent = examples;
|
316 |
+
}
|
317 |
</script>
|
318 |
</body></html>`;
|
319 |
|
|
|
324 |
|
325 |
async function handleVoiceList() {
|
326 |
let voices = [{model: 'ava', gender: 'female'}, {model: 'andrew', gender: 'male'}, {model: 'emma', gender: 'female'}, {model: 'brian', gender: 'male'}, {model: 'vivienne', gender: 'female'}, {model: 'remy', gender: 'male'}, {
|
327 |
+
model: 'seraphina', gender: 'female'
|
|
|
328 |
}, {model: 'florian', gender: 'male'}, {model: 'dmitry', gender: 'male'}, {model: 'svetlana', gender: 'female'}];
|
329 |
|
330 |
const sortedVoiceList = voices.sort((a, b) => {
|