Create templates/tts_template.html
Browse files- templates/tts_template.html +26 -0
templates/tts_template.html
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<!-- app/templates/tts_template.html -->
|
2 |
+
|
3 |
+
<form method="POST" action="/synthesize">
|
4 |
+
<textarea name="text" rows="4" cols="50" placeholder="Enter text to convert to speech"></textarea>
|
5 |
+
<select name="model">
|
6 |
+
{% for model in available_models %}
|
7 |
+
<option value="{{ model }}">{{ model }}</option>
|
8 |
+
{% endfor %}
|
9 |
+
</select>
|
10 |
+
<select name="speaker">
|
11 |
+
{% for speaker in available_speakers %}
|
12 |
+
<option value="{{ speaker }}">{{ speaker }}</option>
|
13 |
+
{% endfor %}
|
14 |
+
</select>
|
15 |
+
<button type="submit">Synthesize</button>
|
16 |
+
</form>
|
17 |
+
<audio controls id="audioPlayer" style="display: none;"></audio>
|
18 |
+
<script>
|
19 |
+
// JavaScript code to play generated audio
|
20 |
+
function playAudio(audioData) {
|
21 |
+
var audioPlayer = document.getElementById("audioPlayer");
|
22 |
+
audioPlayer.src = "data:audio/wav;base64," + audioData;
|
23 |
+
audioPlayer.style.display = "block";
|
24 |
+
audioPlayer.play();
|
25 |
+
}
|
26 |
+
</script>
|