Docs · Quickstart
Quickstart
Ask a model over HTTP, from JavaScript or from a contract.
The Digits model reads a digit drawn on an 8×8 grid: 64 values, 0 for blank and 127 for full ink. Here is a 7.
HTTP
curl -X POST https://www.usewired.net/api/v1/models/0x0fddc7aa3584b716fb13b93fd278b55f0a93205d1a745ba0bfbc195c64c3f6d1/infer \
-H "content-type: application/json" \
-d '{"input":[0,0,0,87,127,127,79,0,0,0,79,95,71,119,71,0,0,0,103,64,0,95,40,0,0,0,48,0,32,95,0,0,0,0,16,119,127,127,71,0,0,0,48,103,119,71,8,0,0,0,0,71,71,0,0,0,0,0,8,111,32,0,0,0]}'{
"label": 7,
"labelName": "7",
"logits": [-5399, -5521, -4737, -2093, -1360, 2524, -612, 9882, 1416, -4192],
"gasUsed": 166458,
"block": "119119953",
"call": { "to": "0x320D078b873912cf8dDe00f750fd16240C457ca7", "data": "0x77b2…" }
}The chain computed it: call is the exact eth_call and block the block it ran at, so you can replay it yourself.
JavaScript
const res = await fetch("https://www.usewired.net/api/v1/models/0x0fddc7aa3584b716fb13b93fd278b55f0a93205d1a745ba0bfbc195c64c3f6d1/infer", {
method: "POST",
headers: { "content-type": "application/json" },
body: JSON.stringify({ input: pixels }), // 64 values from 0 to 127
});
const { label, logits } = await res.json();The API answers from any origin (CORS is open), so this runs in a browser as well as on a server.
Solidity
import {IWired} from "./IWired.sol";
contract SevenLock {
IWired constant WIRED = IWired(0x320D078b873912cf8dDe00f750fd16240C457ca7);
bytes32 constant DIGITS = 0x0fddc7aa3584b716fb13b93fd278b55f0a93205d1a745ba0bfbc195c64c3f6d1;
function unlock(bytes calldata drawing) external view returns (bool) {
(uint256 digit, ) = WIRED.classify(DIGITS, drawing);
return digit == 7;
}
}The full interface is on the Reference page.