Skip to content

Commit

Permalink
enhance the code example
Browse files Browse the repository at this point in the history
  • Loading branch information
Barqawiz committed Apr 24, 2023
1 parent cf96df4 commit 373bf6f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions samples/command_sample/ecommerce_tool.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ const MyKeys = {
google: process.env.GOOGLE_API_KEY,
};

const audioHelper = new AudioHelper();


async function main() {
Expand All @@ -44,7 +45,6 @@ async function main() {

// 4- Generate audio
const decodedAudio = await generateSpeech(textProductDesc, MyKeys.google, 'google');
const audioHelper = new AudioHelper();
audioHelper.saveAudio(decodedAudio, './temp', 'product_description.mp3');
console.log('Audio generated');
}
Expand Down Expand Up @@ -83,7 +83,7 @@ async function generateSpeech(textProductDesc, apiKey, modelBackend) {
const speechModel = new RemoteSpeechModel(apiKey);
const input = new Text2SpeechInput({ text: textProductDesc, language: 'en-gb' });
const audioContent = await speechModel.generateSpeech(input);
const audioHelper = new AudioHelper();

return audioHelper.decode(audioContent);
}

Expand Down

0 comments on commit 373bf6f

Please sign in to comment.