openeye-sh 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (154) hide show
  1. openeye_sh-0.1.0/.dockerignore +10 -0
  2. openeye_sh-0.1.0/.gitignore +48 -0
  3. openeye_sh-0.1.0/Dockerfile +44 -0
  4. openeye_sh-0.1.0/LICENSE +21 -0
  5. openeye_sh-0.1.0/PKG-INFO +123 -0
  6. openeye_sh-0.1.0/README.md +51 -0
  7. openeye_sh-0.1.0/openeye_ai/__init__.py +3 -0
  8. openeye_sh-0.1.0/openeye_ai/_cli_helpers.py +68 -0
  9. openeye_sh-0.1.0/openeye_ai/adapters/__init__.py +0 -0
  10. openeye_sh-0.1.0/openeye_ai/adapters/base.py +48 -0
  11. openeye_sh-0.1.0/openeye_ai/adapters/depth_anything.py +60 -0
  12. openeye_sh-0.1.0/openeye_ai/adapters/grounding_dino.py +81 -0
  13. openeye_sh-0.1.0/openeye_ai/adapters/onnx_runtime.py +80 -0
  14. openeye_sh-0.1.0/openeye_ai/adapters/rfdetr.py +63 -0
  15. openeye_sh-0.1.0/openeye_ai/adapters/sam2.py +85 -0
  16. openeye_sh-0.1.0/openeye_ai/adapters/smolvla.py +66 -0
  17. openeye_sh-0.1.0/openeye_ai/adapters/tensorrt_runtime.py +22 -0
  18. openeye_sh-0.1.0/openeye_ai/adapters/yolo26.py +74 -0
  19. openeye_sh-0.1.0/openeye_ai/adapters/yolov8.py +70 -0
  20. openeye_sh-0.1.0/openeye_ai/adapters/yolov8_onnx.py +94 -0
  21. openeye_sh-0.1.0/openeye_ai/agent/__init__.py +5 -0
  22. openeye_sh-0.1.0/openeye_ai/agent/loop.py +273 -0
  23. openeye_sh-0.1.0/openeye_ai/cli.py +114 -0
  24. openeye_sh-0.1.0/openeye_ai/commands/__init__.py +0 -0
  25. openeye_sh-0.1.0/openeye_ai/commands/agent_cli.py +307 -0
  26. openeye_sh-0.1.0/openeye_ai/commands/api_cli.py +247 -0
  27. openeye_sh-0.1.0/openeye_ai/commands/config.py +34 -0
  28. openeye_sh-0.1.0/openeye_ai/commands/demo.py +76 -0
  29. openeye_sh-0.1.0/openeye_ai/commands/fleet/__init__.py +14 -0
  30. openeye_sh-0.1.0/openeye_ai/commands/fleet/_helpers.py +84 -0
  31. openeye_sh-0.1.0/openeye_ai/commands/fleet/agent.py +59 -0
  32. openeye_sh-0.1.0/openeye_ai/commands/fleet/alerts.py +48 -0
  33. openeye_sh-0.1.0/openeye_ai/commands/fleet/command_queue.py +50 -0
  34. openeye_sh-0.1.0/openeye_ai/commands/fleet/deployments.py +118 -0
  35. openeye_sh-0.1.0/openeye_ai/commands/fleet/devices.py +183 -0
  36. openeye_sh-0.1.0/openeye_ai/commands/fleet/groups.py +109 -0
  37. openeye_sh-0.1.0/openeye_ai/commands/fleet/maintenance.py +94 -0
  38. openeye_sh-0.1.0/openeye_ai/commands/governance.py +418 -0
  39. openeye_sh-0.1.0/openeye_ai/commands/inference/__init__.py +8 -0
  40. openeye_sh-0.1.0/openeye_ai/commands/inference/bench.py +119 -0
  41. openeye_sh-0.1.0/openeye_ai/commands/inference/run.py +400 -0
  42. openeye_sh-0.1.0/openeye_ai/commands/inference/serve.py +174 -0
  43. openeye_sh-0.1.0/openeye_ai/commands/inference/watch.py +493 -0
  44. openeye_sh-0.1.0/openeye_ai/commands/mlops/__init__.py +15 -0
  45. openeye_sh-0.1.0/openeye_ai/commands/mlops/deploy.py +501 -0
  46. openeye_sh-0.1.0/openeye_ai/commands/mlops/evaluate.py +262 -0
  47. openeye_sh-0.1.0/openeye_ai/commands/mlops/train.py +383 -0
  48. openeye_sh-0.1.0/openeye_ai/commands/models.py +318 -0
  49. openeye_sh-0.1.0/openeye_ai/commands/server_cli.py +168 -0
  50. openeye_sh-0.1.0/openeye_ai/config.py +54 -0
  51. openeye_sh-0.1.0/openeye_ai/configs/g1_safety_guardian.yaml +60 -0
  52. openeye_sh-0.1.0/openeye_ai/connectors/__init__.py +0 -0
  53. openeye_sh-0.1.0/openeye_ai/connectors/unitree_g1.py +259 -0
  54. openeye_sh-0.1.0/openeye_ai/demos/__init__.py +0 -0
  55. openeye_sh-0.1.0/openeye_ai/demos/display.py +341 -0
  56. openeye_sh-0.1.0/openeye_ai/demos/g1_safety_demo.py +393 -0
  57. openeye_sh-0.1.0/openeye_ai/demos/vlm_openrouter_demo.py +378 -0
  58. openeye_sh-0.1.0/openeye_ai/fleet_cli.py +5 -0
  59. openeye_sh-0.1.0/openeye_ai/mcp/__init__.py +1 -0
  60. openeye_sh-0.1.0/openeye_ai/mcp/server.py +163 -0
  61. openeye_sh-0.1.0/openeye_ai/mcp/tools.py +68 -0
  62. openeye_sh-0.1.0/openeye_ai/memory/__init__.py +5 -0
  63. openeye_sh-0.1.0/openeye_ai/memory/store.py +101 -0
  64. openeye_sh-0.1.0/openeye_ai/mlops/__init__.py +1 -0
  65. openeye_sh-0.1.0/openeye_ai/mlops/ab_testing.py +173 -0
  66. openeye_sh-0.1.0/openeye_ai/mlops/api.py +543 -0
  67. openeye_sh-0.1.0/openeye_ai/mlops/batch_inference.py +344 -0
  68. openeye_sh-0.1.0/openeye_ai/mlops/benchmark_matrix.py +165 -0
  69. openeye_sh-0.1.0/openeye_ai/mlops/evaluation.py +224 -0
  70. openeye_sh-0.1.0/openeye_ai/mlops/export.py +324 -0
  71. openeye_sh-0.1.0/openeye_ai/mlops/feedback.py +232 -0
  72. openeye_sh-0.1.0/openeye_ai/mlops/lifecycle.py +231 -0
  73. openeye_sh-0.1.0/openeye_ai/mlops/lineage.py +167 -0
  74. openeye_sh-0.1.0/openeye_ai/mlops/model_registry.py +233 -0
  75. openeye_sh-0.1.0/openeye_ai/mlops/persistence.py +84 -0
  76. openeye_sh-0.1.0/openeye_ai/mlops/retraining.py +233 -0
  77. openeye_sh-0.1.0/openeye_ai/mlops/schemas/__init__.py +108 -0
  78. openeye_sh-0.1.0/openeye_ai/mlops/schemas/base.py +131 -0
  79. openeye_sh-0.1.0/openeye_ai/mlops/schemas/governance.py +144 -0
  80. openeye_sh-0.1.0/openeye_ai/mlops/schemas/operations.py +224 -0
  81. openeye_sh-0.1.0/openeye_ai/mlops/schemas/versioning.py +138 -0
  82. openeye_sh-0.1.0/openeye_ai/mlops/shadow_mode.py +158 -0
  83. openeye_sh-0.1.0/openeye_ai/mlops/validation.py +241 -0
  84. openeye_sh-0.1.0/openeye_ai/models.yaml +131 -0
  85. openeye_sh-0.1.0/openeye_ai/registry.py +165 -0
  86. openeye_sh-0.1.0/openeye_ai/schema.py +111 -0
  87. openeye_sh-0.1.0/openeye_ai/server/__init__.py +0 -0
  88. openeye_sh-0.1.0/openeye_ai/server/agent_router.py +302 -0
  89. openeye_sh-0.1.0/openeye_ai/server/agentic_session.py +193 -0
  90. openeye_sh-0.1.0/openeye_ai/server/app.py +80 -0
  91. openeye_sh-0.1.0/openeye_ai/server/dashboard.html +355 -0
  92. openeye_sh-0.1.0/openeye_ai/server/metrics.py +35 -0
  93. openeye_sh-0.1.0/openeye_ai/server/middleware.py +52 -0
  94. openeye_sh-0.1.0/openeye_ai/server/queue.py +72 -0
  95. openeye_sh-0.1.0/openeye_ai/server/rate_limit.py +12 -0
  96. openeye_sh-0.1.0/openeye_ai/server/routes/__init__.py +0 -0
  97. openeye_sh-0.1.0/openeye_ai/server/routes/rest.py +162 -0
  98. openeye_sh-0.1.0/openeye_ai/server/routes/v1.py +309 -0
  99. openeye_sh-0.1.0/openeye_ai/server/routes/websockets.py +447 -0
  100. openeye_sh-0.1.0/openeye_ai/server/state.py +134 -0
  101. openeye_sh-0.1.0/openeye_ai/utils/__init__.py +0 -0
  102. openeye_sh-0.1.0/openeye_ai/utils/benchmark.py +108 -0
  103. openeye_sh-0.1.0/openeye_ai/utils/camera.py +81 -0
  104. openeye_sh-0.1.0/openeye_ai/utils/checksum.py +48 -0
  105. openeye_sh-0.1.0/openeye_ai/utils/custom_adapter.py +42 -0
  106. openeye_sh-0.1.0/openeye_ai/utils/download.py +38 -0
  107. openeye_sh-0.1.0/openeye_ai/utils/hardware.py +102 -0
  108. openeye_sh-0.1.0/openeye_ai/utils/registry_update.py +68 -0
  109. openeye_sh-0.1.0/openeye_ai/utils/unitree_camera.py +231 -0
  110. openeye_sh-0.1.0/openeye_ai/utils/validation.py +55 -0
  111. openeye_sh-0.1.0/openeye_ai/utils/visualize.py +121 -0
  112. openeye_sh-0.1.0/openeye_ai/vlm/__init__.py +5 -0
  113. openeye_sh-0.1.0/openeye_ai/vlm/nebius.py +116 -0
  114. openeye_sh-0.1.0/pyproject.toml +84 -0
  115. openeye_sh-0.1.0/tests/__init__.py +0 -0
  116. openeye_sh-0.1.0/tests/conftest.py +264 -0
  117. openeye_sh-0.1.0/tests/e2e/__init__.py +0 -0
  118. openeye_sh-0.1.0/tests/e2e/conftest.py +37 -0
  119. openeye_sh-0.1.0/tests/e2e/test_pull_run_pipeline.py +88 -0
  120. openeye_sh-0.1.0/tests/fleet/__init__.py +0 -0
  121. openeye_sh-0.1.0/tests/fleet/conftest.py +141 -0
  122. openeye_sh-0.1.0/tests/fleet/test_alerts.py +31 -0
  123. openeye_sh-0.1.0/tests/fleet/test_deployments.py +67 -0
  124. openeye_sh-0.1.0/tests/fleet/test_devices.py +125 -0
  125. openeye_sh-0.1.0/tests/fleet/test_groups.py +47 -0
  126. openeye_sh-0.1.0/tests/fleet/test_maintenance.py +48 -0
  127. openeye_sh-0.1.0/tests/test_adapter_base.py +118 -0
  128. openeye_sh-0.1.0/tests/test_agent_cli.py +182 -0
  129. openeye_sh-0.1.0/tests/test_agent_loop.py +289 -0
  130. openeye_sh-0.1.0/tests/test_agent_router.py +117 -0
  131. openeye_sh-0.1.0/tests/test_api_cli.py +265 -0
  132. openeye_sh-0.1.0/tests/test_benchmark.py +267 -0
  133. openeye_sh-0.1.0/tests/test_checksum.py +80 -0
  134. openeye_sh-0.1.0/tests/test_cli_commands.py +378 -0
  135. openeye_sh-0.1.0/tests/test_config.py +114 -0
  136. openeye_sh-0.1.0/tests/test_custom_adapter.py +99 -0
  137. openeye_sh-0.1.0/tests/test_download.py +20 -0
  138. openeye_sh-0.1.0/tests/test_fleet_agent.py +242 -0
  139. openeye_sh-0.1.0/tests/test_g1_connector.py +183 -0
  140. openeye_sh-0.1.0/tests/test_governance_cli.py +310 -0
  141. openeye_sh-0.1.0/tests/test_hardware.py +97 -0
  142. openeye_sh-0.1.0/tests/test_install_setup.py +785 -0
  143. openeye_sh-0.1.0/tests/test_memory_store.py +139 -0
  144. openeye_sh-0.1.0/tests/test_metrics.py +32 -0
  145. openeye_sh-0.1.0/tests/test_mlops_commands.py +500 -0
  146. openeye_sh-0.1.0/tests/test_queue.py +182 -0
  147. openeye_sh-0.1.0/tests/test_rate_limit.py +83 -0
  148. openeye_sh-0.1.0/tests/test_registry.py +127 -0
  149. openeye_sh-0.1.0/tests/test_run_features.py +612 -0
  150. openeye_sh-0.1.0/tests/test_schema.py +215 -0
  151. openeye_sh-0.1.0/tests/test_server.py +499 -0
  152. openeye_sh-0.1.0/tests/test_v1_api.py +223 -0
  153. openeye_sh-0.1.0/tests/test_validation.py +159 -0
  154. openeye_sh-0.1.0/tests/test_watch.py +374 -0
@@ -0,0 +1,10 @@
1
+ .venv
2
+ __pycache__
3
+ *.pyc
4
+ tests/
5
+ .git
6
+ .github
7
+ .ruff_cache
8
+ *.egg-info
9
+ dist/
10
+ build/
@@ -0,0 +1,48 @@
1
+ # Logs
2
+ logs
3
+ *.log
4
+ npm-debug.log*
5
+ yarn-debug.log*
6
+ yarn-error.log*
7
+ pnpm-debug.log*
8
+ lerna-debug.log*
9
+
10
+ node_modules
11
+ dist
12
+ dist-ssr
13
+ *.local
14
+
15
+ # Editor directories and files
16
+ .vscode/*
17
+ !.vscode/extensions.json
18
+ .idea
19
+ .DS_Store
20
+ *.suo
21
+ *.ntvs*
22
+ *.njsproj
23
+ *.sln
24
+ *.sw?
25
+
26
+ # Python / CLI
27
+ .venv/
28
+ cli/.venv/
29
+ cli/*.egg-info/
30
+ cli/openeye_ai/*.egg-info/
31
+ __pycache__/
32
+ *.pyc
33
+ *.pyo
34
+ *.egg-info/
35
+ *.egg
36
+ .eggs/
37
+ build/
38
+ dist/
39
+
40
+ # Python backend
41
+ backend/.venv/
42
+ .env
43
+ backend/.env
44
+ backend/config/memory/
45
+ backend/dump/
46
+ backend/uv.lock
47
+ *.pt
48
+ *.pth
@@ -0,0 +1,44 @@
1
+ # ---- Builder ----
2
+ FROM python:3.13-slim AS builder
3
+
4
+ WORKDIR /build
5
+
6
+ # Install build dependencies
7
+ RUN apt-get update && apt-get install -y --no-install-recommends \
8
+ gcc \
9
+ && rm -rf /var/lib/apt/lists/*
10
+
11
+ COPY pyproject.toml .
12
+ COPY openeye_ai/ openeye_ai/
13
+
14
+ RUN pip install --no-cache-dir ".[yolo]"
15
+
16
+ # Pre-pull yolov8 model weights
17
+ RUN python -c "from ultralytics import YOLO; YOLO('yolov8n.pt')"
18
+
19
+ # ---- Runtime ----
20
+ FROM python:3.13-slim
21
+
22
+ WORKDIR /app
23
+
24
+ # Copy installed packages from builder
25
+ COPY --from=builder /usr/local/lib/python3.13/site-packages /usr/local/lib/python3.13/site-packages
26
+ COPY --from=builder /usr/local/bin/openeye /usr/local/bin/openeye
27
+ COPY --from=builder /build/openeye_ai /app/openeye_ai
28
+
29
+ # Copy pre-pulled model weights
30
+ COPY --from=builder /root/.openeye /root/.openeye
31
+
32
+ # Install minimal runtime dependencies
33
+ RUN apt-get update && apt-get install -y --no-install-recommends \
34
+ libgl1 \
35
+ libglib2.0-0 \
36
+ && rm -rf /var/lib/apt/lists/*
37
+
38
+ EXPOSE 8000
39
+
40
+ HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
41
+ CMD python -c "import httpx; r = httpx.get('http://localhost:8000/health'); r.raise_for_status()" || exit 1
42
+
43
+ ENTRYPOINT ["openeye"]
44
+ CMD ["serve", "yolov8"]
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 AW3 Technology, Inc.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,123 @@
1
+ Metadata-Version: 2.4
2
+ Name: openeye-sh
3
+ Version: 0.1.0
4
+ Summary: Ollama for vision AI models — pull, run, and serve computer-vision models from your terminal.
5
+ Project-URL: Homepage, https://perceptify.dev
6
+ Project-URL: Repository, https://github.com/aw3-technology/openeye.sh
7
+ Author: OpenEye Team
8
+ License-Expression: MIT
9
+ License-File: LICENSE
10
+ Keywords: ai,cli,depth,detection,vision,yolo
11
+ Classifier: Development Status :: 3 - Alpha
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: License :: OSI Approved :: MIT License
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
16
+ Requires-Python: >=3.10
17
+ Requires-Dist: fastapi>=0.110
18
+ Requires-Dist: httpx>=0.27
19
+ Requires-Dist: huggingface-hub>=0.23
20
+ Requires-Dist: numpy>=1.24
21
+ Requires-Dist: pillow>=10.0
22
+ Requires-Dist: prometheus-client>=0.21
23
+ Requires-Dist: pydantic>=2.0
24
+ Requires-Dist: python-multipart>=0.0.12
25
+ Requires-Dist: pyyaml>=6.0
26
+ Requires-Dist: rich>=13.0
27
+ Requires-Dist: slowapi>=0.1.9
28
+ Requires-Dist: typer[all]>=0.9
29
+ Requires-Dist: uvicorn[standard]>=0.29
30
+ Provides-Extra: all
31
+ Requires-Dist: accelerate; extra == 'all'
32
+ Requires-Dist: openai>=1.0; extra == 'all'
33
+ Requires-Dist: opencv-python>=4.9; extra == 'all'
34
+ Requires-Dist: torch>=2.0; extra == 'all'
35
+ Requires-Dist: transformers>=4.40; extra == 'all'
36
+ Requires-Dist: ultralytics>=8.2; extra == 'all'
37
+ Provides-Extra: camera
38
+ Requires-Dist: opencv-python>=4.9; extra == 'camera'
39
+ Provides-Extra: cloud
40
+ Requires-Dist: boto3>=1.34; extra == 'cloud'
41
+ Requires-Dist: google-cloud-storage>=2.14; extra == 'cloud'
42
+ Provides-Extra: depth
43
+ Requires-Dist: accelerate; extra == 'depth'
44
+ Requires-Dist: torch>=2.0; extra == 'depth'
45
+ Requires-Dist: transformers>=4.40; extra == 'depth'
46
+ Provides-Extra: grounding
47
+ Requires-Dist: accelerate; extra == 'grounding'
48
+ Requires-Dist: torch>=2.0; extra == 'grounding'
49
+ Requires-Dist: transformers>=4.40; extra == 'grounding'
50
+ Provides-Extra: mcp
51
+ Requires-Dist: mcp[cli]>=1.2.0; extra == 'mcp'
52
+ Provides-Extra: onnx
53
+ Requires-Dist: onnxruntime>=1.17; extra == 'onnx'
54
+ Provides-Extra: onnx-gpu
55
+ Requires-Dist: onnxruntime-gpu>=1.17; extra == 'onnx-gpu'
56
+ Provides-Extra: rfdetr
57
+ Requires-Dist: rfdetr>=1.0; extra == 'rfdetr'
58
+ Provides-Extra: sam
59
+ Requires-Dist: segment-anything-2>=0.1; extra == 'sam'
60
+ Requires-Dist: torch>=2.0; extra == 'sam'
61
+ Provides-Extra: smolvla
62
+ Requires-Dist: lerobot>=0.1; extra == 'smolvla'
63
+ Requires-Dist: torch>=2.0; extra == 'smolvla'
64
+ Provides-Extra: tensorrt
65
+ Requires-Dist: onnxruntime-gpu>=1.17; extra == 'tensorrt'
66
+ Requires-Dist: tensorrt>=10.0; extra == 'tensorrt'
67
+ Provides-Extra: vlm
68
+ Requires-Dist: openai>=1.0; extra == 'vlm'
69
+ Provides-Extra: yolo
70
+ Requires-Dist: ultralytics>=8.2; extra == 'yolo'
71
+ Description-Content-Type: text/markdown
72
+
73
+ # openeye-sh
74
+
75
+ **Ollama for vision AI models** — pull, run, and serve computer-vision models from your terminal.
76
+
77
+ ## Install
78
+
79
+ ```bash
80
+ pipx install openeye-sh
81
+ ```
82
+
83
+ With extras:
84
+
85
+ ```bash
86
+ pipx install "openeye-sh[yolo]" # YOLO object detection
87
+ pipx install "openeye-sh[depth]" # Monocular depth estimation
88
+ pipx install "openeye-sh[camera]" # OpenCV camera support
89
+ pipx install "openeye-sh[all]" # YOLO + depth + grounding + camera
90
+ ```
91
+
92
+ ## Quick Start
93
+
94
+ ```bash
95
+ # List available models
96
+ openeye list
97
+
98
+ # Pull a model
99
+ openeye pull yolov8
100
+
101
+ # Run inference on an image
102
+ openeye run yolov8 image.jpg
103
+
104
+ # Start the API server
105
+ openeye serve yolov8
106
+
107
+ # Live camera stream with detection
108
+ openeye watch --models yolov8
109
+ ```
110
+
111
+ ## Features
112
+
113
+ - **Model management** — pull, list, and run vision models (YOLO, depth, grounding, SAM, RF-DETR)
114
+ - **REST & WebSocket API** — FastAPI server with `/predict`, streaming WebSocket endpoints
115
+ - **Live perception** — real-time camera inference with VLM reasoning
116
+ - **Fleet control plane** — manage distributed vision agents
117
+ - **Agentic loop** — continuous perception + reasoning + planning pipeline
118
+ - **Safety guardian** — configurable safety zone monitoring for robotics
119
+
120
+ ## Links
121
+
122
+ - [Homepage](https://perceptify.dev)
123
+ - [Repository](https://github.com/aw3-technology/openeye.sh)
@@ -0,0 +1,51 @@
1
+ # openeye-sh
2
+
3
+ **Ollama for vision AI models** — pull, run, and serve computer-vision models from your terminal.
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ pipx install openeye-sh
9
+ ```
10
+
11
+ With extras:
12
+
13
+ ```bash
14
+ pipx install "openeye-sh[yolo]" # YOLO object detection
15
+ pipx install "openeye-sh[depth]" # Monocular depth estimation
16
+ pipx install "openeye-sh[camera]" # OpenCV camera support
17
+ pipx install "openeye-sh[all]" # YOLO + depth + grounding + camera
18
+ ```
19
+
20
+ ## Quick Start
21
+
22
+ ```bash
23
+ # List available models
24
+ openeye list
25
+
26
+ # Pull a model
27
+ openeye pull yolov8
28
+
29
+ # Run inference on an image
30
+ openeye run yolov8 image.jpg
31
+
32
+ # Start the API server
33
+ openeye serve yolov8
34
+
35
+ # Live camera stream with detection
36
+ openeye watch --models yolov8
37
+ ```
38
+
39
+ ## Features
40
+
41
+ - **Model management** — pull, list, and run vision models (YOLO, depth, grounding, SAM, RF-DETR)
42
+ - **REST & WebSocket API** — FastAPI server with `/predict`, streaming WebSocket endpoints
43
+ - **Live perception** — real-time camera inference with VLM reasoning
44
+ - **Fleet control plane** — manage distributed vision agents
45
+ - **Agentic loop** — continuous perception + reasoning + planning pipeline
46
+ - **Safety guardian** — configurable safety zone monitoring for robotics
47
+
48
+ ## Links
49
+
50
+ - [Homepage](https://perceptify.dev)
51
+ - [Repository](https://github.com/aw3-technology/openeye.sh)
@@ -0,0 +1,3 @@
1
+ """OpenEye AI — Ollama for vision AI models."""
2
+
3
+ __version__ = "0.1.0"
@@ -0,0 +1,68 @@
1
+ """Shared CLI helpers — consoles, constants, and utility functions."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import typer
6
+ from rich import print as rprint
7
+ from rich.console import Console
8
+
9
+ console = Console()
10
+ # Separate console for status/progress in commands whose primary output is JSON
11
+ # to stdout, so spinners don't corrupt piped output.
12
+ err_console = Console(stderr=True)
13
+
14
+ _EXTRAS = {
15
+ "yolov8": "yolo",
16
+ "yolo26": "yolo",
17
+ "depth-anything": "depth",
18
+ "grounding-dino": "grounding",
19
+ "sam2": "sam",
20
+ "rfdetr": "rfdetr",
21
+ "smolvla": "smolvla",
22
+ }
23
+
24
+ _DEMO_WARMUP_RUNS = 5
25
+
26
+
27
+ def warmup_adapter(adapter, name: str, runs: int = _DEMO_WARMUP_RUNS) -> float:
28
+ """Run dummy inference passes to warm up the model. Returns mean latency in ms."""
29
+ import time
30
+
31
+ import numpy as np
32
+ from PIL import Image
33
+
34
+ arr = np.random.randint(0, 255, (480, 640, 3), dtype=np.uint8)
35
+ test_img = Image.fromarray(arr)
36
+
37
+ times: list[float] = []
38
+ for _ in range(runs):
39
+ t0 = time.perf_counter()
40
+ adapter.predict(test_img)
41
+ times.append((time.perf_counter() - t0) * 1000)
42
+
43
+ mean = sum(times) / len(times) if times else 0.0
44
+ fps_str = f"{1000 / mean:.0f}" if mean > 0 else "∞"
45
+ rprint(
46
+ f" [dim]Warm-up complete:[/dim] {runs} passes, "
47
+ f"mean [bold cyan]{mean:.1f} ms[/bold cyan] "
48
+ f"([bold cyan]{fps_str} FPS[/bold cyan])"
49
+ )
50
+ return mean
51
+
52
+
53
+ def _install_hint(extra: str) -> str:
54
+ """Return install instructions that cover pip, pipx, and zsh quoting."""
55
+ return (
56
+ f'Install with: [bold]pip install "openeye-sh\\[{extra}]"[/bold]\n'
57
+ f' or (pipx): [bold]pipx install "openeye-sh\\[{extra}]" --force[/bold]\n'
58
+ f" [dim](Quotes required in zsh/fish due to bracket expansion)[/dim]"
59
+ )
60
+
61
+
62
+ def dependency_error(model: str, exc: ImportError) -> None:
63
+ extra = _EXTRAS.get(model, model)
64
+ rprint(
65
+ f"[red]Missing dependencies for '{model}': {exc.name or exc}[/red]\n"
66
+ + _install_hint(extra)
67
+ )
68
+ raise typer.Exit(code=1)
File without changes
@@ -0,0 +1,48 @@
1
+ """Abstract base class for model adapters."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from abc import ABC, abstractmethod
6
+ from pathlib import Path
7
+ from typing import Any
8
+
9
+ from PIL import Image
10
+
11
+
12
+ class ModelNotLoadedError(RuntimeError):
13
+ """Raised when predict() is called before load()."""
14
+
15
+
16
+ class ModelAdapter(ABC):
17
+ """Every model adapter must implement load() and predict()."""
18
+
19
+ _loaded: bool = False
20
+
21
+ def load(self, model_dir: Path) -> None:
22
+ """Load model weights from disk."""
23
+ self._do_load(model_dir)
24
+ self._loaded = True
25
+
26
+ @abstractmethod
27
+ def _do_load(self, model_dir: Path) -> None:
28
+ """Subclass hook: actually load weights."""
29
+
30
+ def predict(self, image: Image.Image) -> dict[str, Any]:
31
+ """Run inference on a PIL Image and return a result dict."""
32
+ if not self._loaded:
33
+ raise ModelNotLoadedError("Model not loaded. Call load() before predict().")
34
+ return self._do_predict(image)
35
+
36
+ @abstractmethod
37
+ def _do_predict(self, image: Image.Image) -> dict[str, Any]:
38
+ """Subclass hook: run inference.
39
+
40
+ Must include keys compatible with PredictionResult schema:
41
+ - objects: list[dict] (for detection models)
42
+ - depth_map: str | None (for depth models)
43
+ - inference_ms: float
44
+ """
45
+
46
+ @abstractmethod
47
+ def pull(self, model_dir: Path) -> None:
48
+ """Download model weights to model_dir."""
@@ -0,0 +1,60 @@
1
+ """Depth Anything V2 adapter — monocular depth estimation via transformers."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import base64
6
+ import io
7
+ import time
8
+ from pathlib import Path
9
+ from typing import Any
10
+
11
+ from PIL import Image
12
+
13
+ from openeye_ai.adapters.base import ModelAdapter
14
+
15
+ HF_REPO = "depth-anything/Depth-Anything-V2-Small-hf"
16
+
17
+
18
+ class Adapter(ModelAdapter):
19
+ def __init__(self) -> None:
20
+ self._pipe = None
21
+
22
+ def pull(self, model_dir: Path) -> None:
23
+ from openeye_ai.utils.download import download_from_hf
24
+
25
+ download_from_hf(HF_REPO, model_dir)
26
+
27
+ def _do_load(self, model_dir: Path) -> None:
28
+ from transformers import pipeline
29
+
30
+ self._pipe = pipeline("depth-estimation", model=str(model_dir), device="cpu")
31
+
32
+ def _do_predict(self, image: Image.Image) -> dict[str, Any]:
33
+ import numpy as np
34
+
35
+ start = time.perf_counter()
36
+ result = self._pipe(image)
37
+ elapsed = (time.perf_counter() - start) * 1000
38
+
39
+ depth = result["depth"] # PIL Image
40
+ # Normalize to 0-255 grayscale PNG
41
+ depth_arr = np.array(depth, dtype=np.float32)
42
+ dmin, dmax = depth_arr.min(), depth_arr.max()
43
+ if dmax - dmin < 1e-8:
44
+ # Flat depth — return uniform gray
45
+ depth_img = Image.fromarray(
46
+ (128 * np.ones_like(depth_arr)).astype(np.uint8)
47
+ )
48
+ else:
49
+ depth_norm = (depth_arr - dmin) / (dmax - dmin)
50
+ depth_img = Image.fromarray((depth_norm * 255).astype(np.uint8))
51
+
52
+ buf = io.BytesIO()
53
+ depth_img.save(buf, format="PNG")
54
+ depth_b64 = base64.b64encode(buf.getvalue()).decode()
55
+
56
+ return {
57
+ "objects": [],
58
+ "depth_map": depth_b64,
59
+ "inference_ms": round(elapsed, 2),
60
+ }
@@ -0,0 +1,81 @@
1
+ """Grounding DINO adapter — open-vocabulary detection via transformers."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import time
6
+ from pathlib import Path
7
+ from typing import Any
8
+
9
+ from PIL import Image
10
+
11
+ from openeye_ai.adapters.base import ModelAdapter
12
+
13
+ HF_REPO = "IDEA-Research/grounding-dino-tiny"
14
+
15
+
16
+ class Adapter(ModelAdapter):
17
+ def __init__(self) -> None:
18
+ self._processor = None
19
+ self._model_obj = None
20
+
21
+ def pull(self, model_dir: Path) -> None:
22
+ from openeye_ai.utils.download import download_from_hf
23
+
24
+ download_from_hf(HF_REPO, model_dir)
25
+
26
+ def _do_load(self, model_dir: Path) -> None:
27
+ from transformers import AutoModelForZeroShotObjectDetection, AutoProcessor
28
+
29
+ self._processor = AutoProcessor.from_pretrained(str(model_dir))
30
+ self._model_obj = AutoModelForZeroShotObjectDetection.from_pretrained(str(model_dir))
31
+
32
+ def _do_predict(self, image: Image.Image) -> dict[str, Any]:
33
+ return self.predict_with_prompt(image, "object")
34
+
35
+ def predict_with_prompt(self, image: Image.Image, prompt: str) -> dict[str, Any]:
36
+ if not self._loaded:
37
+ from openeye_ai.adapters.base import ModelNotLoadedError
38
+ raise ModelNotLoadedError("Model not loaded. Call load() before predict_with_prompt().")
39
+
40
+ import torch
41
+
42
+ # Grounding DINO expects prompt ending with period
43
+ text = prompt.strip()
44
+ if not text.endswith("."):
45
+ text += "."
46
+
47
+ start = time.perf_counter()
48
+ inputs = self._processor(images=image, text=text, return_tensors="pt")
49
+ with torch.no_grad():
50
+ outputs = self._model_obj(**inputs)
51
+
52
+ target_sizes = torch.tensor([image.size[::-1]])
53
+ results = self._processor.post_process_grounded_object_detection(
54
+ outputs, inputs["input_ids"], threshold=0.3, target_sizes=target_sizes
55
+ )[0]
56
+ elapsed = (time.perf_counter() - start) * 1000
57
+
58
+ w_img, h_img = image.size
59
+ objects = []
60
+ for score, label, box in zip(
61
+ results["scores"].tolist(),
62
+ results["text_labels"],
63
+ results["boxes"].tolist(),
64
+ ):
65
+ x1, y1, x2, y2 = box
66
+ objects.append({
67
+ "label": label,
68
+ "confidence": round(score, 4),
69
+ "bbox": {
70
+ "x": round(x1 / w_img, 4),
71
+ "y": round(y1 / h_img, 4),
72
+ "w": round((x2 - x1) / w_img, 4),
73
+ "h": round((y2 - y1) / h_img, 4),
74
+ },
75
+ })
76
+
77
+ return {
78
+ "objects": objects,
79
+ "depth_map": None,
80
+ "inference_ms": round(elapsed, 2),
81
+ }
@@ -0,0 +1,80 @@
1
+ """ONNX Runtime base adapter."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from pathlib import Path
6
+ from typing import Any
7
+
8
+ from PIL import Image
9
+
10
+ from openeye_ai.adapters.base import ModelAdapter
11
+
12
+
13
+ class ONNXAdapter(ModelAdapter):
14
+ """Base adapter for models running via ONNX Runtime."""
15
+
16
+ def __init__(self) -> None:
17
+ self._session = None
18
+
19
+ def pull(self, model_dir: Path) -> None:
20
+ from openeye_ai.utils.download import download_from_hf
21
+
22
+ # Default pull uses HF download; subclasses can override
23
+ info = self._get_registry_info()
24
+ if info:
25
+ download_from_hf(info["hf_repo"], model_dir, info.get("filename"))
26
+
27
+ def _get_registry_info(self) -> dict[str, Any] | None:
28
+ """Override in subclasses to return model info for pulling."""
29
+ return None
30
+
31
+ def _do_load(self, model_dir: Path) -> None:
32
+ import onnxruntime as ort
33
+
34
+ onnx_files = list(model_dir.glob("*.onnx"))
35
+ if not onnx_files:
36
+ raise FileNotFoundError(f"No .onnx file found in {model_dir}")
37
+
38
+ model_path = onnx_files[0]
39
+ providers = self._get_providers()
40
+ self._session = ort.InferenceSession(str(model_path), providers=providers)
41
+
42
+ def _get_providers(self) -> list[str]:
43
+ """Return ordered list of ONNX Runtime execution providers."""
44
+ providers = []
45
+ try:
46
+ import torch
47
+
48
+ if torch.cuda.is_available():
49
+ providers.append("CUDAExecutionProvider")
50
+ except ImportError:
51
+ pass
52
+ providers.append("CPUExecutionProvider")
53
+ return providers
54
+
55
+ def preprocess(self, image: Image.Image):
56
+ """Preprocess image to numpy array. Override for model-specific preprocessing."""
57
+ import numpy as np
58
+
59
+ img = image.resize((640, 640))
60
+ arr = np.array(img).astype(np.float32) / 255.0
61
+ arr = arr.transpose(2, 0, 1) # HWC -> CHW
62
+ return np.expand_dims(arr, axis=0) # add batch dim
63
+
64
+ def postprocess(self, outputs: list, image: Image.Image) -> dict[str, Any]:
65
+ """Postprocess ONNX outputs. Override for model-specific postprocessing."""
66
+ return {"objects": [], "depth_map": None, "inference_ms": 0.0}
67
+
68
+ def _do_predict(self, image: Image.Image) -> dict[str, Any]:
69
+ import time
70
+
71
+ input_tensor = self.preprocess(image)
72
+ input_name = self._session.get_inputs()[0].name
73
+
74
+ start = time.perf_counter()
75
+ outputs = self._session.run(None, {input_name: input_tensor})
76
+ elapsed = (time.perf_counter() - start) * 1000
77
+
78
+ result = self.postprocess(outputs, image)
79
+ result["inference_ms"] = round(elapsed, 2)
80
+ return result