"""GPU proof script — runs INSIDE the TripoSR HF Job after generation. Reads the freshly generated GLB from the mounted HF Bucket, stores it in the content-addressed layer on that same bucket, and validates it with gltf-mcp. Prints a single PROOF: line with the verdict. """ import glob import json import os import sys sys.path.insert(0, "/tmp/m3d") from m3d.modules.gltf_mcp import build_module as build_gltf from m3d.store import Store candidates = sorted(glob.glob("/data/out/*/mesh.glb")) assert candidates, f"no mesh.glb produced under /data/out: {glob.glob('/data/out/*')}" glb = candidates[-1] store = Store(root="/data/cas") uri = store.put_file(glb) gltf = build_gltf(store) v = gltf.run_tool("validate", {"uri": uri}) s = gltf.run_tool("stats", {"uri": uri}) print( "PROOF:", json.dumps( { "glb_path": glb, "bytes": os.path.getsize(glb), "cas_uri": uri, "valid": v["valid"], "generator": v.get("generator"), "triangles": s.get("triangles"), "vertices": s.get("vertices"), } ), )