Spaces:
Runtime error
Runtime error
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<title>Token Classification</title> | |
<style> | |
body { | |
font-family: Arial, sans-serif; | |
margin: 0; | |
padding: 20px; | |
background-color: #f0f0f0; | |
} | |
.container { | |
max-width: 600px; | |
margin: auto; | |
background: white; | |
padding: 20px; | |
border-radius: 8px; | |
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1); | |
} | |
h1 { | |
text-align: center; | |
} | |
textarea { | |
width: 100%; | |
height: 100px; | |
padding: 10px; | |
border-radius: 4px; | |
border: 1px solid #ccc; | |
margin-bottom: 10px; | |
} | |
button { | |
display: block; | |
width: 100%; | |
padding: 10px; | |
background-color: #007BFF; | |
color: white; | |
border: none; | |
border-radius: 4px; | |
cursor: pointer; | |
} | |
button:hover { | |
background-color: #0056b3; | |
} | |
.result { | |
margin-top: 20px; | |
background: #e9ecef; | |
padding: 10px; | |
border-radius: 4px; | |
} | |
.result pre { | |
white-space: pre-wrap; | |
word-wrap: break-word; | |
} | |
</style> | |
</head> | |
<body> | |
<div class="container"> | |
<h1>Token Classification</h1> | |
<textarea id="inputText" placeholder="Enter text here..."></textarea> | |
<button onclick="classifyText()">Classify</button> | |
<div class="result" id="result"> | |
<h2>Results:</h2> | |
<pre id="resultText"></pre> | |
</div> | |
</div> | |
<script> | |
async function classifyText() { | |
const text = document.getElementById('inputText').value; | |
const response = await fetch('https://cuddly-space-doodle-rpqw95jqp7pcwprx-5000.app.github.dev/classify', { | |
method: 'POST', | |
headers: { | |
'Content-Type': 'application/json' | |
}, | |
body: JSON.stringify({ text }) | |
}); | |
const result = await response.json(); | |
document.getElementById('resultText').textContent = JSON.stringify(result, null, 2); | |
} | |
</script> | |
</body> | |
</html> |