smjain commited on
Commit
b647760
1 Parent(s): aa36621

Upload ui.html

Browse files
Files changed (1) hide show
  1. templates/ui.html +35 -0
templates/ui.html ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!-- Include jQuery for simplicity -->
2
+ <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
3
+
4
+ <script>
5
+ $(document).ready(function() {
6
+ $('#uploadForm').submit(function(e) {
7
+ e.preventDefault();
8
+ var formData = new FormData(this);
9
+
10
+ $.ajax({
11
+ url: '/convert_voice',
12
+ type: 'POST',
13
+ data: formData,
14
+ success: function(data) {
15
+ if (data.audio_id) {
16
+ // Update the source of the processed audio element
17
+ $('#processedAudio source').attr('src', '/get_processed_audio/' + data.audio_id);
18
+ $('#processedAudio')[0].load();
19
+ $('#processedAudio')[0].play();
20
+ }
21
+ },
22
+ cache: false,
23
+ contentType: false,
24
+ processData: false
25
+ });
26
+ });
27
+ });
28
+ </script>
29
+
30
+ <!-- Processed Audio Playback -->
31
+ <h3>Processed Audio:</h3>
32
+ <audio id="processedAudio" controls>
33
+ <source src="" type="audio/wav">
34
+ Your browser does not support the audio element.
35
+ </audio>