$ cat node-template.py
3
3D Model Creation
// Generates a 3D model (GLB) from a single image. Creates textured mesh with configurable polygon count and texture resolution.
Process
3D
template.py
1import os2import sys3import json4import traceback56from gais import Gais78INPUT_DIR = "/data/input"9OUTPUT_DIR = "/data/output"101112def main():13 try:14 input_json = sys.stdin.read()15 execution_input = json.loads(input_json)16 inputs = execution_input.get("inputs", {})17 service_defaults = execution_input.get("service_defaults", {})1819 image = inputs.get("image", "")20 if not image:21 raise ValueError("Input image is required")2223 max_faces = inputs.get("max_faces", 200000)24 texture_size = inputs.get("texture_size", "1024")2526 local_path = os.path.join(INPUT_DIR, image)27 if not os.path.exists(local_path):28 raise FileNotFoundError(f"Input image not found: {local_path}")2930 os.makedirs(OUTPUT_DIR, exist_ok=True)3132 print(33 f"Requesting 3D model generation: max_faces={max_faces}, "34 f"texture_size={texture_size}",35 file=sys.stderr,36 )3738 result = Gais.model.create(39 media=local_path,40 max_faces=max_faces,41 texture_size=texture_size,42 )4344 # Save result as binary GLB45 out_filename = "generated_model.glb"46 out_path = os.path.join(OUTPUT_DIR, out_filename)47 with open(out_path, "wb") as f:48 f.write(result.content)4950 inference_time = result.metadata.get("inference_time_ms", "unknown")51 print(52 f"3D model generated: time={inference_time}ms, "53 f"max_faces={max_faces}, texture_size={texture_size}",54 file=sys.stderr,55 )5657 output = {58 "model": out_filename,59 }60 print(json.dumps(output, indent=2))6162 except Exception as e:63 error_output = {64 "error": str(e),65 "errorType": type(e).__name__,66 "traceback": traceback.format_exc(),67 }68 print(json.dumps(error_output), file=sys.stderr)69 sys.exit(1)707172if __name__ == "__main__":73 main()$ git log --oneline
v1.3.1
HEAD
2026-05-07v1.1.02026-03-29
v1.0.02026-03-20