Spaces:
Sleeping
Sleeping
File size: 1,095 Bytes
145f349 |
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 28 29 30 31 32 33 34 35 36 |
<!-- Include jQuery for simplicity -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script>
$(document).ready(function() {
$('#uploadForm').submit(function(e) {
e.preventDefault();
var formData = new FormData(this);
$.ajax({
url: '/convert_voice',
type: 'POST',
data: formData,
success: function(data) {
if (data.audio_id) {
// Update the source of the processed audio element
$('#processedAudio source').attr('src', '/get_processed_audio/' + data.audio_id);
$('#processedAudio')[0].load();
$('#processedAudio')[0].play();
}
},
cache: false,
contentType: false,
processData: false
});
});
});
</script>
<!-- Processed Audio Playback -->
<h3>Processed Audio:</h3>
<audio id="processedAudio" controls>
<source src="" type="audio/wav">
Your browser does not support the audio element.
</audio>
|