Spaces:
Runtime error
Runtime error
Update templates/interface.html
Browse files- templates/interface.html +27 -8
templates/interface.html
CHANGED
|
@@ -56,15 +56,34 @@
|
|
| 56 |
<button type="button" id="close_button" onclick="closeGUI()">Exit</button>
|
| 57 |
</div>
|
| 58 |
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
|
|
|
|
|
|
|
|
|
| 67 |
</form>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 68 |
<script>
|
| 69 |
// JavaScript function for handling the "Exit" button click
|
| 70 |
function closeGUI() {
|
|
|
|
| 56 |
<button type="button" id="close_button" onclick="closeGUI()">Exit</button>
|
| 57 |
</div>
|
| 58 |
|
| 59 |
+
{% if file_url %}
|
| 60 |
+
<h2>Generated Audio</h2>
|
| 61 |
+
<audio controls id="audio-player">
|
| 62 |
+
<source src="{{ file_url }}" type="audio/mpeg">
|
| 63 |
+
Your browser does not support the audio element.
|
| 64 |
+
</audio>
|
| 65 |
+
<a href="{{ file_url }}" download>Download Audio</a>
|
| 66 |
+
{% endif %}
|
| 67 |
+
|
| 68 |
+
|
| 69 |
+
|
| 70 |
</form>
|
| 71 |
+
<script>
|
| 72 |
+
// Get references to the checkbox and audio elements
|
| 73 |
+
const playCheckbox = document.getElementById("play");
|
| 74 |
+
const audioPlayer = document.getElementById("audio-player");
|
| 75 |
+
|
| 76 |
+
// Add an event listener to the checkbox
|
| 77 |
+
playCheckbox.addEventListener("change", function () {
|
| 78 |
+
// If the checkbox is checked, add the autoplay attribute
|
| 79 |
+
if (playCheckbox.checked) {
|
| 80 |
+
audioPlayer.setAttribute("autoplay", "");
|
| 81 |
+
} else {
|
| 82 |
+
// If the checkbox is unchecked, remove the autoplay attribute
|
| 83 |
+
audioPlayer.removeAttribute("autoplay");
|
| 84 |
+
}
|
| 85 |
+
});
|
| 86 |
+
</script>
|
| 87 |
<script>
|
| 88 |
// JavaScript function for handling the "Exit" button click
|
| 89 |
function closeGUI() {
|