File size: 951 Bytes
dd42b97 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
<!-- 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>
|