File size: 925 Bytes
30a2cb3
 
 
 
 
 
 
ed204db
 
 
 
 
 
 
 
30a2cb3
 
 
ee0467c
 
3ab9683
e8aef90
30a2cb3
 
ed204db
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
<!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>