campose-api / src /utils /hashRequest.mts
jbilcke-hf's picture
jbilcke-hf HF staff
initial commit
5b3c62d
raw
history blame
645 Bytes
import { RenderRequest } from "../types.mts"
import { computeSha256 } from "./computeSha256.mts"
export function hashRequest(request: RenderRequest) {
// we ignore the commands associated to cache and stuff
const hashable = {
version: 1,
prompt: request.prompt,
segmentation: request.segmentation,
actionnables: request.actionnables,
nbFrames: request.nbFrames,
nbSteps: request.nbSteps,
// seed: request.seed,
width: request.width,
height: request.height,
projection: request.projection,
}
const requestJson = JSON.stringify(hashable)
const hash = computeSha256(requestJson)
return hash
}