Loginauth / templates /tts_template.html
Gregniuki's picture
Create templates/tts_template.html
dd42b97
raw
history blame
951 Bytes
<!-- app/templates/tts_template.html -->
<form method="POST" action="/synthesize">
<textarea name="text" rows="4" cols="50" placeholder="Enter text to convert to speech"></textarea>
<select name="model">
{% for model in available_models %}
<option value="{{ model }}">{{ model }}</option>
{% endfor %}
</select>
<select name="speaker">
{% for speaker in available_speakers %}
<option value="{{ speaker }}">{{ speaker }}</option>
{% endfor %}
</select>
<button type="submit">Synthesize</button>
</form>
<audio controls id="audioPlayer" style="display: none;"></audio>
<script>
// JavaScript code to play generated audio
function playAudio(audioData) {
var audioPlayer = document.getElementById("audioPlayer");
audioPlayer.src = "data:audio/wav;base64," + audioData;
audioPlayer.style.display = "block";
audioPlayer.play();
}
</script>