$ cat node-template.py
I
Image Analysis
// Analyzes images using computer vision. Generates detailed captions, text extraction (OCR), and object detection with bounding boxes.
Process
Image
template.py
1import os2import sys3import json4import traceback56from gais import Gais78INPUT_DIR = "/data/input"91011def main():12 try:13 input_json = sys.stdin.read()14 execution_input = json.loads(input_json)15 inputs = execution_input.get("inputs", {})16 service_defaults = execution_input.get("service_defaults", {})1718 image = inputs.get("image", "")19 task = inputs.get("task", "more_detailed_caption")2021 if not image:22 raise ValueError("Image is required")2324 valid_tasks = [25 "caption", "detailed_caption", "more_detailed_caption",26 "ocr", "ocr_with_region", "object_detection", "dense_region_caption",27 ]28 if task not in valid_tasks:29 raise ValueError(f"Invalid task '{task}'. Must be one of: {valid_tasks}")3031 local_path = os.path.join(INPUT_DIR, image)32 if not os.path.exists(local_path):33 raise FileNotFoundError(f"Input image not found: {local_path}")3435 result = Gais.image.analyze(36 image=local_path,37 task=task,38 )3940 result_data = json.loads(result.content)41 result_text = result_data.get("text", "")4243 print(f"Vision analysis complete: task={task}", file=sys.stderr)4445 # Flat output — keys match OUTPUT_SCHEMA46 output = {47 "text": result_text,48 }49 print(json.dumps(output, indent=2))5051 except Exception as e:52 error_output = {53 "error": str(e),54 "errorType": type(e).__name__,55 "traceback": traceback.format_exc(),56 }57 print(json.dumps(error_output), file=sys.stderr)58 sys.exit(1)596061if __name__ == "__main__":62 main()$ git log --oneline
v1.3.0
HEAD
2026-05-07v1.0.02026-04-09