timbosssds commited on
Commit
087be0c
·
verified ·
1 Parent(s): a6092cf

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +5 -8
index.html CHANGED
@@ -12,18 +12,15 @@
12
  <p id="output"></p>
13
 
14
  <script>
15
- function sendRequest() {
16
  const userInput = document.getElementById("user_input").value;
17
- fetch('/predict', {
18
  method: 'POST',
19
  headers: { 'Content-Type': 'application/json' },
20
  body: JSON.stringify({ input: userInput })
21
- })
22
- .then(response => response.json())
23
- .then(data => {
24
- document.getElementById("output").innerHTML = data.output;
25
- })
26
- .catch(error => console.error(error));
27
  }
28
  </script>
29
  </body>
 
12
  <p id="output"></p>
13
 
14
  <script>
15
+ async function sendRequest() {
16
  const userInput = document.getElementById("user_input").value;
17
+ const response = await fetch('/predict', {
18
  method: 'POST',
19
  headers: { 'Content-Type': 'application/json' },
20
  body: JSON.stringify({ input: userInput })
21
+ });
22
+ const data = await response.json();
23
+ document.getElementById("output").innerHTML = data.output;
 
 
 
24
  }
25
  </script>
26
  </body>