Spaces:
Runtime error
Runtime error
Create index.html
Browse files- index.html +30 -0
index.html
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html lang="en">
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="UTF-8">
|
| 5 |
+
<title>LLM Text App</title>
|
| 6 |
+
</head>
|
| 7 |
+
<body>
|
| 8 |
+
<h1>Text Input</h1>
|
| 9 |
+
<textarea id="user_input" rows="5"></textarea>
|
| 10 |
+
<br>
|
| 11 |
+
<button onclick="sendRequest()">Send to LLM</button>
|
| 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>
|
| 30 |
+
</html>
|