File size: 884 Bytes
66e3394
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
"""Run the external vision bridge against a local image or URL.

Usage:
  python examples/vision_bridge.py image.jpg "What is visible?"

The first run downloads the explicitly selected captioner checkpoint. The
DeepSeek/CORTEX checkpoint is not downloaded or modified by this script.
"""

import argparse

from cortex_ai.vision.bridge import build_default_bridge


if __name__ == "__main__":
    parser = argparse.ArgumentParser()
    parser.add_argument("image", help="local image path or image URL")
    parser.add_argument("question", nargs="?", default="Describe this image.")
    parser.add_argument("--device", default=None, help="pipeline device, e.g. 0 for CUDA")
    args = parser.parse_args()

    kwargs = {"device": int(args.device)} if args.device is not None else {}
    bridge = build_default_bridge(**kwargs)
    print(bridge.build_context(args.image, args.question))