smjain commited on
Commit
795056a
·
verified ·
1 Parent(s): af0c90e

Upload ui.html

Browse files
Files changed (1) hide show
  1. templates/ui.html +25 -8
templates/ui.html CHANGED
@@ -12,12 +12,10 @@
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="kishorkumar">Kishor</option>
20
- </select>
21
  <br><br>
22
 
23
  <label for="file">Audio File:</label>
@@ -41,6 +39,9 @@
41
 
42
  <script>
43
  $(document).ready(function() {
 
 
 
44
  $('#uploadForm').submit(function(e) {
45
  e.preventDefault();
46
  var formData = new FormData(this);
@@ -49,7 +50,7 @@ $(document).ready(function() {
49
  url: '/convert_voice',
50
  type: 'POST',
51
  data: formData,
52
- timeout: 180000,
53
  success: function(data) {
54
  if (data.audio_id) {
55
  // Start polling for status
@@ -77,7 +78,6 @@ $(document).ready(function() {
77
  success: function(data) {
78
  $('#statusDisplay').text(`${data.status} - ${data.percentage}% complete`);
79
  if (data.status !== "Completed" && data.status !== "Failed") {
80
-
81
  setTimeout(() => updateTaskStatus(audioId), 1000); // Poll every second
82
  } else {
83
  if (data.status === "Completed") {
@@ -90,6 +90,23 @@ $(document).ready(function() {
90
  }
91
  });
92
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
93
  });
94
  </script>
95
 
 
12
 
13
  <form id="uploadForm" enctype="multipart/form-data">
14
  <label for="spk_id">Speaker:</label>
15
+ <select id="weightsDropdown">
16
+ <!-- Options will be added here dynamically -->
17
+ </select>
18
+
 
 
19
  <br><br>
20
 
21
  <label for="file">Audio File:</label>
 
39
 
40
  <script>
41
  $(document).ready(function() {
42
+ // Load weights into the dropdown
43
+ loadWeights();
44
+
45
  $('#uploadForm').submit(function(e) {
46
  e.preventDefault();
47
  var formData = new FormData(this);
 
50
  url: '/convert_voice',
51
  type: 'POST',
52
  data: formData,
53
+ timeout: 180000, // 3 minutes
54
  success: function(data) {
55
  if (data.audio_id) {
56
  // Start polling for status
 
78
  success: function(data) {
79
  $('#statusDisplay').text(`${data.status} - ${data.percentage}% complete`);
80
  if (data.status !== "Completed" && data.status !== "Failed") {
 
81
  setTimeout(() => updateTaskStatus(audioId), 1000); // Poll every second
82
  } else {
83
  if (data.status === "Completed") {
 
90
  }
91
  });
92
  }
93
+
94
+ // Function to load weights into the dropdown
95
+ function loadWeights() {
96
+ $.ajax({
97
+ url: '/list-weights',
98
+ type: 'GET',
99
+ success: function(files) {
100
+ const dropdown = $('#weightsDropdown');
101
+ files.forEach(function(file) {
102
+ dropdown.append($('<option></option>').attr('value', file).text(file));
103
+ });
104
+ },
105
+ error: function(xhr) {
106
+ alert("Error loading weights: " + xhr.responseText);
107
+ }
108
+ });
109
+ }
110
  });
111
  </script>
112