Spaces:
Runtime error
Runtime error
Update index.html
Browse files- 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 |
-
|
| 23 |
-
.
|
| 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>
|