Spaces:
Running
Running
Update api.js
Browse files
api.js
CHANGED
|
@@ -193,12 +193,12 @@ function concatenateAudioFiles(audioFiles, outputFilePath) {
|
|
| 193 |
// This is for multi-party TTS... For ordinary TTS call api/generate/utterance
|
| 194 |
app.get('api/generate/speech', async (req, res) => {
|
| 195 |
const {payload} = req.query
|
| 196 |
-
await generateSpeechFromScript(payload)
|
| 197 |
})
|
| 198 |
|
| 199 |
app.post('api/generate/speech', async (req, res) =>{
|
| 200 |
const {payload} = req.body
|
| 201 |
-
await generateSpeechFromScript(payload)
|
| 202 |
})
|
| 203 |
|
| 204 |
|
|
@@ -206,10 +206,11 @@ app.post('api/generate/speech', async (req, res) =>{
|
|
| 206 |
// This is normal TTS: specify voice, text, model. Voices are from openai, use those names or the aliases in lookup table
|
| 207 |
app.get('api/generate/utterance', async (req, res) => {
|
| 208 |
const {voice, text, model} = req.query
|
| 209 |
-
|
| 210 |
-
|
|
|
|
| 211 |
// We want the browser to cache this response, because there's no reason to TTS the same text-voice-model combination more than once
|
| 212 |
-
res.sendFile(path.resolve(outputFilename), { headers: { 'Content-Type': 'audio/mpeg', 'Cache-Control':'Max-Age=8640000' } });
|
| 213 |
})
|
| 214 |
|
| 215 |
app.post('api/generate/utterance', async (req, res) =>{
|
|
|
|
| 193 |
// This is for multi-party TTS... For ordinary TTS call api/generate/utterance
|
| 194 |
app.get('api/generate/speech', async (req, res) => {
|
| 195 |
const {payload} = req.query
|
| 196 |
+
await generateSpeechFromScript(payload, res)
|
| 197 |
})
|
| 198 |
|
| 199 |
app.post('api/generate/speech', async (req, res) =>{
|
| 200 |
const {payload} = req.body
|
| 201 |
+
await generateSpeechFromScript(payload, res)
|
| 202 |
})
|
| 203 |
|
| 204 |
|
|
|
|
| 206 |
// This is normal TTS: specify voice, text, model. Voices are from openai, use those names or the aliases in lookup table
|
| 207 |
app.get('api/generate/utterance', async (req, res) => {
|
| 208 |
const {voice, text, model} = req.query
|
| 209 |
+
console.log("Utterance Params", {voice, text, model})
|
| 210 |
+
//const outputFilename= await generateAudio(voice, text, model || "tts-1")
|
| 211 |
+
|
| 212 |
// We want the browser to cache this response, because there's no reason to TTS the same text-voice-model combination more than once
|
| 213 |
+
//await res.sendFile(path.resolve(outputFilename), { headers: { 'Content-Type': 'audio/mpeg', 'Cache-Control':'Max-Age=8640000' } });
|
| 214 |
})
|
| 215 |
|
| 216 |
app.post('api/generate/utterance', async (req, res) =>{
|