Spaces:
Runtime error
Runtime error
front_end
Browse files- index.html +84 -0
index.html
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html lang="en">
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="UTF-8">
|
| 5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
+
<title>Token Classification</title>
|
| 7 |
+
<style>
|
| 8 |
+
body {
|
| 9 |
+
font-family: Arial, sans-serif;
|
| 10 |
+
margin: 0;
|
| 11 |
+
padding: 20px;
|
| 12 |
+
background-color: #f0f0f0;
|
| 13 |
+
}
|
| 14 |
+
.container {
|
| 15 |
+
max-width: 600px;
|
| 16 |
+
margin: auto;
|
| 17 |
+
background: white;
|
| 18 |
+
padding: 20px;
|
| 19 |
+
border-radius: 8px;
|
| 20 |
+
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
|
| 21 |
+
}
|
| 22 |
+
h1 {
|
| 23 |
+
text-align: center;
|
| 24 |
+
}
|
| 25 |
+
textarea {
|
| 26 |
+
width: 100%;
|
| 27 |
+
height: 100px;
|
| 28 |
+
padding: 10px;
|
| 29 |
+
border-radius: 4px;
|
| 30 |
+
border: 1px solid #ccc;
|
| 31 |
+
margin-bottom: 10px;
|
| 32 |
+
}
|
| 33 |
+
button {
|
| 34 |
+
display: block;
|
| 35 |
+
width: 100%;
|
| 36 |
+
padding: 10px;
|
| 37 |
+
background-color: #007BFF;
|
| 38 |
+
color: white;
|
| 39 |
+
border: none;
|
| 40 |
+
border-radius: 4px;
|
| 41 |
+
cursor: pointer;
|
| 42 |
+
}
|
| 43 |
+
button:hover {
|
| 44 |
+
background-color: #0056b3;
|
| 45 |
+
}
|
| 46 |
+
.result {
|
| 47 |
+
margin-top: 20px;
|
| 48 |
+
background: #e9ecef;
|
| 49 |
+
padding: 10px;
|
| 50 |
+
border-radius: 4px;
|
| 51 |
+
}
|
| 52 |
+
.result pre {
|
| 53 |
+
white-space: pre-wrap;
|
| 54 |
+
word-wrap: break-word;
|
| 55 |
+
}
|
| 56 |
+
</style>
|
| 57 |
+
</head>
|
| 58 |
+
<body>
|
| 59 |
+
<div class="container">
|
| 60 |
+
<h1>Token Classification</h1>
|
| 61 |
+
<textarea id="inputText" placeholder="Enter text here..."></textarea>
|
| 62 |
+
<button onclick="classifyText()">Classify</button>
|
| 63 |
+
<div class="result" id="result">
|
| 64 |
+
<h2>Results:</h2>
|
| 65 |
+
<pre id="resultText"></pre>
|
| 66 |
+
</div>
|
| 67 |
+
</div>
|
| 68 |
+
|
| 69 |
+
<script>
|
| 70 |
+
async function classifyText() {
|
| 71 |
+
const text = document.getElementById('inputText').value;
|
| 72 |
+
const response = await fetch('https://cuddly-space-doodle-rpqw95jqp7pcwprx-5000.app.github.dev/classify', {
|
| 73 |
+
method: 'POST',
|
| 74 |
+
headers: {
|
| 75 |
+
'Content-Type': 'application/json'
|
| 76 |
+
},
|
| 77 |
+
body: JSON.stringify({ text })
|
| 78 |
+
});
|
| 79 |
+
const result = await response.json();
|
| 80 |
+
document.getElementById('resultText').textContent = JSON.stringify(result, null, 2);
|
| 81 |
+
}
|
| 82 |
+
</script>
|
| 83 |
+
</body>
|
| 84 |
+
</html>
|