smjain commited on
Commit
56909dd
·
verified ·
1 Parent(s): b647760

Upload ui.html

Browse files
Files changed (1) hide show
  1. templates/ui.html +41 -8
templates/ui.html CHANGED
@@ -1,5 +1,38 @@
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() {
@@ -13,10 +46,14 @@ $(document).ready(function() {
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,
@@ -27,9 +64,5 @@ $(document).ready(function() {
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>
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <title>Audio Conversion</title>
6
+ <!-- Include jQuery for simplicity -->
7
+ <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
8
+ </head>
9
+ <body>
10
+
11
+ <h2>Upload Audio for Conversion</h2>
12
+
13
+ <form id="uploadForm" enctype="multipart/form-data">
14
+ <label for="spk_id">Speaker:</label>
15
+ <select name="spk_id" id="spk_id">
16
+ <option value="trips">Trips</option>
17
+ <option value="modi">Modi</option>
18
+ <option value="khujli">Khujli</option>
19
+ <option value="kishor">Kishor</option>
20
+ </select>
21
+ <br><br>
22
+
23
+ <label for="file">Audio File:</label>
24
+ <input type="file" id="file" name="file" required>
25
+ <br><br>
26
+
27
+ <input type="submit" value="Convert Voice">
28
+ </form>
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>
36
 
37
  <script>
38
  $(document).ready(function() {
 
46
  data: formData,
47
  success: function(data) {
48
  if (data.audio_id) {
49
+ // Assuming your Flask route returns a JSON with an 'audio_id' key
50
  // Update the source of the processed audio element
51
  $('#processedAudio source').attr('src', '/get_processed_audio/' + data.audio_id);
52
  $('#processedAudio')[0].load();
53
  $('#processedAudio')[0].play();
54
+ } else {
55
+ // Handle error or no audio_id in response
56
+ alert("Error or no audio_id returned from server.");
57
  }
58
  },
59
  cache: false,
 
64
  });
65
  </script>
66
 
67
+ </body>
68
+ </html>