File size: 1,110 Bytes
c1bcbbe
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
"""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"),
        }
    ),
)