Spaces:
Running
Running
Update templates/interface.html
Browse files- templates/interface.html +22 -6
templates/interface.html
CHANGED
@@ -36,11 +36,12 @@
|
|
36 |
|
37 |
<div>
|
38 |
<label for="selected_speaker_id">Select a speaker:</label>
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
|
|
44 |
</div>
|
45 |
|
46 |
<div id="speaker_selection" style="display: none;">
|
@@ -71,7 +72,22 @@
|
|
71 |
<div>
|
72 |
<button type="submit" id="synthesize_button">Synthesize</button>
|
73 |
</div>
|
74 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
75 |
|
76 |
|
77 |
{% if file_url %}
|
|
|
36 |
|
37 |
<div>
|
38 |
<label for="selected_speaker_id">Select a speaker:</label>
|
39 |
+
<!-- Add a select element to choose the speaker -->
|
40 |
+
<select id="speaker_select" name="selected_speaker_id">
|
41 |
+
{% for speaker_id, speaker_name in speaker_id_map.items() %}
|
42 |
+
<option value="{{ speaker_id }}">{{ speaker_name }}</option>
|
43 |
+
{% endfor %}
|
44 |
+
</select>
|
45 |
</div>
|
46 |
|
47 |
<div id="speaker_selection" style="display: none;">
|
|
|
72 |
<div>
|
73 |
<button type="submit" id="synthesize_button">Synthesize</button>
|
74 |
</div>
|
75 |
+
// Add an event listener to load the speaker_id_map when the page loads
|
76 |
+
window.addEventListener("load", function() {
|
77 |
+
// Fetch the speaker_id_map from the server
|
78 |
+
fetch("/get_speaker_id_map")
|
79 |
+
.then(response => response.json())
|
80 |
+
.then(data => {
|
81 |
+
// Populate the select element with speaker names
|
82 |
+
var speakerSelect = document.getElementById("speaker_select");
|
83 |
+
for (var speakerId in data.speaker_id_map) {
|
84 |
+
var option = document.createElement("option");
|
85 |
+
option.value = speakerId;
|
86 |
+
option.textContent = data.speaker_id_map[speakerId];
|
87 |
+
speakerSelect.appendChild(option);
|
88 |
+
}
|
89 |
+
});
|
90 |
+
});
|
91 |
|
92 |
|
93 |
{% if file_url %}
|