From e452a926f22c26b3e880c6855b403cbcdc8ea416 Mon Sep 17 00:00:00 2001 From: erew123 <35898566+erew123@users.noreply.github.com> Date: Tue, 2 Jan 2024 20:30:16 +0000 Subject: [PATCH] adding params to demo generate params.ip_address & params.port_number --- templates/admin.html | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/templates/admin.html b/templates/admin.html index 52ccb1b..5774c30 100644 --- a/templates/admin.html +++ b/templates/admin.html @@ -400,6 +400,9 @@ }); // Form submit const form = document.getElementById('ttsForm'); + const ipAddress = "{{ params.ip_address }}"; + const portNumber = "{{ params.port_number }}"; + const baseurl = `http://${ipAddress}:${portNumber}`; form.addEventListener('submit', async (event) => { event.preventDefault(); @@ -425,7 +428,7 @@ if (formData.get('streaming') === 'true') { // For streaming, update the audio player src const searchParams = new URLSearchParams(formData).toString(); - audioPlayer.src = "/tts-demo-request?" + searchParams; + audioPlayer.src = baseurl + "/tts-demo-request?" + searchParams; audioPlayer.load(); // Reload the audio player } else { // For non-streaming, send a POST request @@ -440,7 +443,7 @@ // Update output file path and audio player source const outputFilePath = document.getElementById('outputFilePath'); outputFilePath.textContent = result.output_file_path; - audioPlayer.src = `/audio/${result.output_file_path}`; + audioPlayer.src = baseurl + `/audio/${result.output_file_path}`; audioPlayer.load(); // Reload the audio player } });