From aab944312242c4f8f498d5881af19ebf7ad5c9d1 Mon Sep 17 00:00:00 2001 From: Gabriel de Marmiesse Date: Mon, 12 Jan 2026 15:02:14 +0100 Subject: [PATCH] Give priority to the wav upload in the html page (#9) --- pocket_tts/static/index.html | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/pocket_tts/static/index.html b/pocket_tts/static/index.html index b36c9a0..b648edc 100644 --- a/pocket_tts/static/index.html +++ b/pocket_tts/static/index.html @@ -281,16 +281,16 @@ const formData = new FormData(); formData.append('text', text); - // Add voice URL if provided + // Add voice URL if provided (only if no WAV file is uploaded) const voiceUrl = document.getElementById('voice-url-input').value.trim(); - if (voiceUrl) { - formData.append('voice_url', voiceUrl); - } - - // Add voice WAV file if uploaded const voiceWavFile = document.getElementById('voice-wav-input').files[0]; + if (voiceWavFile) { + // If WAV file is uploaded, only use the WAV file (ignore voice URL) formData.append('voice_wav', voiceWavFile); + } else if (voiceUrl) { + // Only use voice URL if no WAV file is uploaded + formData.append('voice_url', voiceUrl); } const response = await fetch('/tts', {