inference-request / index.html
coyotte508's picture
coyotte508 HF Staff
Update index.html
ee0467c verified
raw
history blame contribute delete
925 Bytes
<!doctype html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width" />
<title>My static Space</title>
<link rel="stylesheet" href="style.css" />
<script>
window.addEventListener("message", event => {
console.log("event", event);
if (event.data.type === "INFERENCE_JWT_RESPONSE") {
document.querySelector("#token").textContent = JSON.stringify(event.data, null, 2);
}
})
</script>
</head>
<body>
<div class="card">
<h1>Request JWT token from HF</h1>
<p>You can request an inference token for the user from HF, with a postMessage call</p>
<button onclick="window.parent?.postMessage({type: 'INFERENCE_JWT_REQUEST'}, '*');">Request token</button>
<pre id="token" style="white-space: pre-wrap; word-wrap: break-word;">...</pre>
</div>
</body>
</html>