neuralhive 1.0.1__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.
- neuralhive-1.0.1/LICENSE +19 -0
- neuralhive-1.0.1/MANIFEST.in +8 -0
- neuralhive-1.0.1/PKG-INFO +270 -0
- neuralhive-1.0.1/README.md +253 -0
- neuralhive-1.0.1/pyproject.toml +54 -0
- neuralhive-1.0.1/setup.cfg +4 -0
- neuralhive-1.0.1/src/neuralhive/__init__.py +8 -0
- neuralhive-1.0.1/src/neuralhive/_shared.py +153 -0
- neuralhive-1.0.1/src/neuralhive/adapters/__init__.py +51 -0
- neuralhive-1.0.1/src/neuralhive/adapters/face_detection.py +42 -0
- neuralhive-1.0.1/src/neuralhive/adapters/face_recognition.py +29 -0
- neuralhive-1.0.1/src/neuralhive/adapters/image_generation.py +25 -0
- neuralhive-1.0.1/src/neuralhive/adapters/instance_segmentation.py +42 -0
- neuralhive-1.0.1/src/neuralhive/adapters/object_detection.py +70 -0
- neuralhive-1.0.1/src/neuralhive/adapters/person_reid.py +62 -0
- neuralhive-1.0.1/src/neuralhive/adapters/pose_estimation.py +35 -0
- neuralhive-1.0.1/src/neuralhive/adapters/sam3.py +55 -0
- neuralhive-1.0.1/src/neuralhive/adapters/slm.py +43 -0
- neuralhive-1.0.1/src/neuralhive/adapters/text_embeddings.py +27 -0
- neuralhive-1.0.1/src/neuralhive/adapters/three_d_asset_generation.py +51 -0
- neuralhive-1.0.1/src/neuralhive/adapters/vlm.py +138 -0
- neuralhive-1.0.1/src/neuralhive/cli.py +55 -0
- neuralhive-1.0.1/src/neuralhive/client.py +835 -0
- neuralhive-1.0.1/src/neuralhive/core/__init__.py +5 -0
- neuralhive-1.0.1/src/neuralhive/core/capabilities.py +82 -0
- neuralhive-1.0.1/src/neuralhive/core/config.py +55 -0
- neuralhive-1.0.1/src/neuralhive/core/credentials.py +78 -0
- neuralhive-1.0.1/src/neuralhive/core/errors.py +54 -0
- neuralhive-1.0.1/src/neuralhive/core/http.py +133 -0
- neuralhive-1.0.1/src/neuralhive/models/__init__.py +34 -0
- neuralhive-1.0.1/src/neuralhive/models/catalog.py +82 -0
- neuralhive-1.0.1/src/neuralhive/models/clip_embeddings.py +76 -0
- neuralhive-1.0.1/src/neuralhive/models/face_detection.py +13 -0
- neuralhive-1.0.1/src/neuralhive/models/face_recognition.py +12 -0
- neuralhive-1.0.1/src/neuralhive/models/image_generation.py +12 -0
- neuralhive-1.0.1/src/neuralhive/models/instance_segmentation.py +13 -0
- neuralhive-1.0.1/src/neuralhive/models/object_detection.py +13 -0
- neuralhive-1.0.1/src/neuralhive/models/person_reid.py +13 -0
- neuralhive-1.0.1/src/neuralhive/models/pose_estimation.py +13 -0
- neuralhive-1.0.1/src/neuralhive/models/sam3.py +13 -0
- neuralhive-1.0.1/src/neuralhive/models/slm.py +12 -0
- neuralhive-1.0.1/src/neuralhive/models/text_embeddings.py +12 -0
- neuralhive-1.0.1/src/neuralhive/models/three_d_asset_generation.py +34 -0
- neuralhive-1.0.1/src/neuralhive/models/vlm.py +22 -0
- neuralhive-1.0.1/src/neuralhive/services/__init__.py +4 -0
- neuralhive-1.0.1/src/neuralhive/services/inference.py +54 -0
- neuralhive-1.0.1/src/neuralhive/services/models.py +36 -0
- neuralhive-1.0.1/src/neuralhive.egg-info/PKG-INFO +270 -0
- neuralhive-1.0.1/src/neuralhive.egg-info/SOURCES.txt +51 -0
- neuralhive-1.0.1/src/neuralhive.egg-info/dependency_links.txt +1 -0
- neuralhive-1.0.1/src/neuralhive.egg-info/entry_points.txt +2 -0
- neuralhive-1.0.1/src/neuralhive.egg-info/requires.txt +4 -0
- neuralhive-1.0.1/src/neuralhive.egg-info/top_level.txt +1 -0
neuralhive-1.0.1/LICENSE
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
Copyright (c) Altrova
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
4
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
5
|
+
in the Software without restriction, including without limitation the rights
|
|
6
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
7
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
8
|
+
furnished to do so, subject to the following conditions:
|
|
9
|
+
|
|
10
|
+
The above copyright notice and this permission notice shall be included in all
|
|
11
|
+
copies or substantial portions of the Software.
|
|
12
|
+
|
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
14
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
15
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
16
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
17
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
18
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
19
|
+
SOFTWARE.
|
|
@@ -0,0 +1,270 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: neuralhive
|
|
3
|
+
Version: 1.0.1
|
|
4
|
+
Summary: NeuralHive Python SDK for model access and inference
|
|
5
|
+
Author-email: Muhammad Khazq <mrkhaziq.dev@gmail.com>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://neuralhive.ai
|
|
8
|
+
Classifier: Programming Language :: Python :: 3
|
|
9
|
+
Classifier: Operating System :: OS Independent
|
|
10
|
+
Requires-Python: >=3.9
|
|
11
|
+
Description-Content-Type: text/markdown
|
|
12
|
+
License-File: LICENSE
|
|
13
|
+
Requires-Dist: requests>=2.31.0
|
|
14
|
+
Provides-Extra: dev
|
|
15
|
+
Requires-Dist: mypy>=1.19.1; extra == "dev"
|
|
16
|
+
Dynamic: license-file
|
|
17
|
+
|
|
18
|
+
# NeuralHive SDK
|
|
19
|
+
|
|
20
|
+
Python SDK client for NeuralHive model access.
|
|
21
|
+
|
|
22
|
+
## Installation
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
pip install neuralhive
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Authentication Setup
|
|
29
|
+
|
|
30
|
+
### Option 1: Configure once (recommended)
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
neuralhive configure --api-key nh_live_your_api_key
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Then use SDK without passing key in code.
|
|
37
|
+
|
|
38
|
+
### Option 2: Environment variable
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
export NEURALHIVE_API_KEY="nh_live_your_api_key"
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### Option 3: Pass key directly in code
|
|
45
|
+
|
|
46
|
+
```python
|
|
47
|
+
client = Client("nh_live_your_api_key")
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## Quick Start
|
|
51
|
+
|
|
52
|
+
```python
|
|
53
|
+
from neuralhive import Client
|
|
54
|
+
|
|
55
|
+
client = Client()
|
|
56
|
+
models = client.list_models()
|
|
57
|
+
print(models)
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## Usage
|
|
61
|
+
|
|
62
|
+
### 1. List models
|
|
63
|
+
|
|
64
|
+
```python
|
|
65
|
+
from neuralhive import Client
|
|
66
|
+
|
|
67
|
+
client = Client("nh_live_your_api_key")
|
|
68
|
+
models = client.list_models()
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### 2. Get model details
|
|
72
|
+
|
|
73
|
+
```python
|
|
74
|
+
model = client.get_model("your_model_id")
|
|
75
|
+
print(model)
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### 3. Run model inference
|
|
79
|
+
|
|
80
|
+
```python
|
|
81
|
+
from neuralhive import Client
|
|
82
|
+
|
|
83
|
+
client = Client("nh_live_your_api_key")
|
|
84
|
+
|
|
85
|
+
result = client.detect(
|
|
86
|
+
model_id="your_object_detection_model_id",
|
|
87
|
+
image="<base64_image>",
|
|
88
|
+
)
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
For all other methods, see **API Reference** below.
|
|
92
|
+
|
|
93
|
+
## API Reference
|
|
94
|
+
|
|
95
|
+
### `Client(api_key: str | None = None)`
|
|
96
|
+
|
|
97
|
+
| Parameter | Type | Required | Description |
|
|
98
|
+
| --------- | ----- | -------- | ----------------------- |
|
|
99
|
+
| `api_key` | `str` | No | Your NeuralHive API key |
|
|
100
|
+
|
|
101
|
+
Returns:
|
|
102
|
+
|
|
103
|
+
- `Client` instance
|
|
104
|
+
|
|
105
|
+
Notes:
|
|
106
|
+
- Authentication is validated automatically on first API call.
|
|
107
|
+
- Production recommendation: avoid hardcoded API keys in source code.
|
|
108
|
+
|
|
109
|
+
### `client.list_models()`
|
|
110
|
+
|
|
111
|
+
Parameters:
|
|
112
|
+
|
|
113
|
+
- None
|
|
114
|
+
|
|
115
|
+
Returns:
|
|
116
|
+
|
|
117
|
+
- `list[dict]` containing allowed models for this API key
|
|
118
|
+
|
|
119
|
+
### `client.get_model(model_id)`
|
|
120
|
+
|
|
121
|
+
| Parameter | Type | Required | Description |
|
|
122
|
+
| ---------- | ----- | -------- | ----------------------- |
|
|
123
|
+
| `model_id` | `str` | Yes | Target model identifier |
|
|
124
|
+
|
|
125
|
+
Returns:
|
|
126
|
+
|
|
127
|
+
- `dict` with model details
|
|
128
|
+
|
|
129
|
+
### `client.detect(model_id, image, prompt=None)`
|
|
130
|
+
|
|
131
|
+
| Parameter | Type | Required | Description |
|
|
132
|
+
| ---------- | ----- | -------- | ------------------------------------------- |
|
|
133
|
+
| `model_id` | `str` | Yes | Target model identifier |
|
|
134
|
+
| `image` | `str` | Yes | Base64 image input |
|
|
135
|
+
| `prompt` | `str` | No | Optional prompt (required for SAM-like IDs) |
|
|
136
|
+
|
|
137
|
+
Returns:
|
|
138
|
+
|
|
139
|
+
- `dict`
|
|
140
|
+
|
|
141
|
+
### `client.segment(model_id, image, prompt=None)`
|
|
142
|
+
|
|
143
|
+
| Parameter | Type | Required | Description |
|
|
144
|
+
| ---------- | ----- | -------- | ------------------------------------------- |
|
|
145
|
+
| `model_id` | `str` | Yes | Target model identifier |
|
|
146
|
+
| `image` | `str` | Yes | Base64 image input |
|
|
147
|
+
| `prompt` | `str` | No | Optional prompt (required for SAM-like IDs) |
|
|
148
|
+
|
|
149
|
+
Returns:
|
|
150
|
+
|
|
151
|
+
- `dict`
|
|
152
|
+
|
|
153
|
+
### `client.recognize(model_id, image)`
|
|
154
|
+
|
|
155
|
+
| Parameter | Type | Required | Description |
|
|
156
|
+
| ---------- | ----- | -------- | ----------------------- |
|
|
157
|
+
| `model_id` | `str` | Yes | Target model identifier |
|
|
158
|
+
| `image` | `str` | Yes | Base64 image input |
|
|
159
|
+
|
|
160
|
+
Returns:
|
|
161
|
+
|
|
162
|
+
- `list[float]` (face embeddings)
|
|
163
|
+
|
|
164
|
+
### `client.reidentify(model_id, image)`
|
|
165
|
+
|
|
166
|
+
| Parameter | Type | Required | Description |
|
|
167
|
+
| ---------- | ----- | -------- | ----------------------- |
|
|
168
|
+
| `model_id` | `str` | Yes | Target model identifier |
|
|
169
|
+
| `image` | `str` | Yes | Base64 image input |
|
|
170
|
+
|
|
171
|
+
Returns:
|
|
172
|
+
|
|
173
|
+
- `dict`
|
|
174
|
+
|
|
175
|
+
### `client.estimate_pose(model_id, image)`
|
|
176
|
+
|
|
177
|
+
| Parameter | Type | Required | Description |
|
|
178
|
+
| ---------- | ----- | -------- | ----------------------- |
|
|
179
|
+
| `model_id` | `str` | Yes | Target model identifier |
|
|
180
|
+
| `image` | `str` | Yes | Base64 image input |
|
|
181
|
+
|
|
182
|
+
Returns:
|
|
183
|
+
|
|
184
|
+
- `dict`
|
|
185
|
+
|
|
186
|
+
### `client.embed(model_id, text=None, image=None)`
|
|
187
|
+
|
|
188
|
+
| Parameter | Type | Required | Description |
|
|
189
|
+
| ---------- | ----- | -------- | -------------------------------------------------- |
|
|
190
|
+
| `model_id` | `str` | Yes | Target model identifier |
|
|
191
|
+
| `text` | `str` | No | Text input |
|
|
192
|
+
| `image` | `str` | No | Base64 image input |
|
|
193
|
+
|
|
194
|
+
Notes:
|
|
195
|
+
|
|
196
|
+
- Exactly one input is required: `text` or `image`
|
|
197
|
+
|
|
198
|
+
Returns:
|
|
199
|
+
|
|
200
|
+
- `list[float]` or `list[list[float]]`
|
|
201
|
+
|
|
202
|
+
### `client.generate_text(model_id, prompt, image=None, images=None, videos=None)`
|
|
203
|
+
|
|
204
|
+
| Parameter | Type | Required | Description |
|
|
205
|
+
| ---------- | -------------------- | -------- | ------------------------------------- |
|
|
206
|
+
| `model_id` | `str` | Yes | Target model identifier |
|
|
207
|
+
| `prompt` | `str` | Yes | Text prompt |
|
|
208
|
+
| `image` | `str` | No | Single base64 image |
|
|
209
|
+
| `images` | `str` or `list[str]` | No | Base64 image(s) |
|
|
210
|
+
| `videos` | `str` or `list[str]` | No | Video URL(s) or base64 video input(s) |
|
|
211
|
+
|
|
212
|
+
Returns:
|
|
213
|
+
|
|
214
|
+
- `str`
|
|
215
|
+
|
|
216
|
+
### `client.analyze(model_id, text=None, images=None, videos=None)`
|
|
217
|
+
|
|
218
|
+
| Parameter | Type | Required | Description |
|
|
219
|
+
| ---------- | -------------------- | -------- | ------------------------------------- |
|
|
220
|
+
| `model_id` | `str` | Yes | Target model identifier |
|
|
221
|
+
| `text` | `str` | No | Text input |
|
|
222
|
+
| `images` | `str` or `list[str]` | No | Base64 image(s) |
|
|
223
|
+
| `videos` | `str` or `list[str]` | No | Video URL(s) or base64 video input(s) |
|
|
224
|
+
|
|
225
|
+
Notes:
|
|
226
|
+
|
|
227
|
+
- At least one input is required: `text` or `images` or `videos`
|
|
228
|
+
|
|
229
|
+
Returns:
|
|
230
|
+
|
|
231
|
+
- `str`
|
|
232
|
+
|
|
233
|
+
### `client.generate_image(model_id, prompt)`
|
|
234
|
+
|
|
235
|
+
| Parameter | Type | Required | Description |
|
|
236
|
+
| ---------- | ----- | -------- | ----------------------- |
|
|
237
|
+
| `model_id` | `str` | Yes | Target model identifier |
|
|
238
|
+
| `prompt` | `str` | Yes | Text prompt |
|
|
239
|
+
|
|
240
|
+
Returns:
|
|
241
|
+
|
|
242
|
+
- `str` (generated image URL, empty string if unavailable)
|
|
243
|
+
|
|
244
|
+
### `client.generate_3d(model_id, image=None, prompt=None)`
|
|
245
|
+
|
|
246
|
+
| Parameter | Type | Required | Description |
|
|
247
|
+
| ---------- | ----- | -------- | ------------------------------------------ |
|
|
248
|
+
| `model_id` | `str` | Yes | Target model identifier |
|
|
249
|
+
| `image` | `str` | No | Base64 image input |
|
|
250
|
+
| `prompt` | `str` | No | Optional prompt input |
|
|
251
|
+
|
|
252
|
+
Notes:
|
|
253
|
+
|
|
254
|
+
- Provide at least one input: `image` or `prompt`
|
|
255
|
+
|
|
256
|
+
Returns:
|
|
257
|
+
|
|
258
|
+
- `str` (3D asset URL, empty string if unavailable)
|
|
259
|
+
|
|
260
|
+
## Input Validation
|
|
261
|
+
|
|
262
|
+
- `model_id` is required for all inference methods.
|
|
263
|
+
- `task_type` is never required from user.
|
|
264
|
+
- `image` and `images` must be base64-encoded strings when provided.
|
|
265
|
+
- Unsupported fields for selected model are rejected before request dispatch.
|
|
266
|
+
- Missing required fields for selected model are rejected before request dispatch.
|
|
267
|
+
|
|
268
|
+
## Contract
|
|
269
|
+
|
|
270
|
+
Frozen contract file is included in repository.
|
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
# NeuralHive SDK
|
|
2
|
+
|
|
3
|
+
Python SDK client for NeuralHive model access.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pip install neuralhive
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Authentication Setup
|
|
12
|
+
|
|
13
|
+
### Option 1: Configure once (recommended)
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
neuralhive configure --api-key nh_live_your_api_key
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Then use SDK without passing key in code.
|
|
20
|
+
|
|
21
|
+
### Option 2: Environment variable
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
export NEURALHIVE_API_KEY="nh_live_your_api_key"
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
### Option 3: Pass key directly in code
|
|
28
|
+
|
|
29
|
+
```python
|
|
30
|
+
client = Client("nh_live_your_api_key")
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Quick Start
|
|
34
|
+
|
|
35
|
+
```python
|
|
36
|
+
from neuralhive import Client
|
|
37
|
+
|
|
38
|
+
client = Client()
|
|
39
|
+
models = client.list_models()
|
|
40
|
+
print(models)
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Usage
|
|
44
|
+
|
|
45
|
+
### 1. List models
|
|
46
|
+
|
|
47
|
+
```python
|
|
48
|
+
from neuralhive import Client
|
|
49
|
+
|
|
50
|
+
client = Client("nh_live_your_api_key")
|
|
51
|
+
models = client.list_models()
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### 2. Get model details
|
|
55
|
+
|
|
56
|
+
```python
|
|
57
|
+
model = client.get_model("your_model_id")
|
|
58
|
+
print(model)
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### 3. Run model inference
|
|
62
|
+
|
|
63
|
+
```python
|
|
64
|
+
from neuralhive import Client
|
|
65
|
+
|
|
66
|
+
client = Client("nh_live_your_api_key")
|
|
67
|
+
|
|
68
|
+
result = client.detect(
|
|
69
|
+
model_id="your_object_detection_model_id",
|
|
70
|
+
image="<base64_image>",
|
|
71
|
+
)
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
For all other methods, see **API Reference** below.
|
|
75
|
+
|
|
76
|
+
## API Reference
|
|
77
|
+
|
|
78
|
+
### `Client(api_key: str | None = None)`
|
|
79
|
+
|
|
80
|
+
| Parameter | Type | Required | Description |
|
|
81
|
+
| --------- | ----- | -------- | ----------------------- |
|
|
82
|
+
| `api_key` | `str` | No | Your NeuralHive API key |
|
|
83
|
+
|
|
84
|
+
Returns:
|
|
85
|
+
|
|
86
|
+
- `Client` instance
|
|
87
|
+
|
|
88
|
+
Notes:
|
|
89
|
+
- Authentication is validated automatically on first API call.
|
|
90
|
+
- Production recommendation: avoid hardcoded API keys in source code.
|
|
91
|
+
|
|
92
|
+
### `client.list_models()`
|
|
93
|
+
|
|
94
|
+
Parameters:
|
|
95
|
+
|
|
96
|
+
- None
|
|
97
|
+
|
|
98
|
+
Returns:
|
|
99
|
+
|
|
100
|
+
- `list[dict]` containing allowed models for this API key
|
|
101
|
+
|
|
102
|
+
### `client.get_model(model_id)`
|
|
103
|
+
|
|
104
|
+
| Parameter | Type | Required | Description |
|
|
105
|
+
| ---------- | ----- | -------- | ----------------------- |
|
|
106
|
+
| `model_id` | `str` | Yes | Target model identifier |
|
|
107
|
+
|
|
108
|
+
Returns:
|
|
109
|
+
|
|
110
|
+
- `dict` with model details
|
|
111
|
+
|
|
112
|
+
### `client.detect(model_id, image, prompt=None)`
|
|
113
|
+
|
|
114
|
+
| Parameter | Type | Required | Description |
|
|
115
|
+
| ---------- | ----- | -------- | ------------------------------------------- |
|
|
116
|
+
| `model_id` | `str` | Yes | Target model identifier |
|
|
117
|
+
| `image` | `str` | Yes | Base64 image input |
|
|
118
|
+
| `prompt` | `str` | No | Optional prompt (required for SAM-like IDs) |
|
|
119
|
+
|
|
120
|
+
Returns:
|
|
121
|
+
|
|
122
|
+
- `dict`
|
|
123
|
+
|
|
124
|
+
### `client.segment(model_id, image, prompt=None)`
|
|
125
|
+
|
|
126
|
+
| Parameter | Type | Required | Description |
|
|
127
|
+
| ---------- | ----- | -------- | ------------------------------------------- |
|
|
128
|
+
| `model_id` | `str` | Yes | Target model identifier |
|
|
129
|
+
| `image` | `str` | Yes | Base64 image input |
|
|
130
|
+
| `prompt` | `str` | No | Optional prompt (required for SAM-like IDs) |
|
|
131
|
+
|
|
132
|
+
Returns:
|
|
133
|
+
|
|
134
|
+
- `dict`
|
|
135
|
+
|
|
136
|
+
### `client.recognize(model_id, image)`
|
|
137
|
+
|
|
138
|
+
| Parameter | Type | Required | Description |
|
|
139
|
+
| ---------- | ----- | -------- | ----------------------- |
|
|
140
|
+
| `model_id` | `str` | Yes | Target model identifier |
|
|
141
|
+
| `image` | `str` | Yes | Base64 image input |
|
|
142
|
+
|
|
143
|
+
Returns:
|
|
144
|
+
|
|
145
|
+
- `list[float]` (face embeddings)
|
|
146
|
+
|
|
147
|
+
### `client.reidentify(model_id, image)`
|
|
148
|
+
|
|
149
|
+
| Parameter | Type | Required | Description |
|
|
150
|
+
| ---------- | ----- | -------- | ----------------------- |
|
|
151
|
+
| `model_id` | `str` | Yes | Target model identifier |
|
|
152
|
+
| `image` | `str` | Yes | Base64 image input |
|
|
153
|
+
|
|
154
|
+
Returns:
|
|
155
|
+
|
|
156
|
+
- `dict`
|
|
157
|
+
|
|
158
|
+
### `client.estimate_pose(model_id, image)`
|
|
159
|
+
|
|
160
|
+
| Parameter | Type | Required | Description |
|
|
161
|
+
| ---------- | ----- | -------- | ----------------------- |
|
|
162
|
+
| `model_id` | `str` | Yes | Target model identifier |
|
|
163
|
+
| `image` | `str` | Yes | Base64 image input |
|
|
164
|
+
|
|
165
|
+
Returns:
|
|
166
|
+
|
|
167
|
+
- `dict`
|
|
168
|
+
|
|
169
|
+
### `client.embed(model_id, text=None, image=None)`
|
|
170
|
+
|
|
171
|
+
| Parameter | Type | Required | Description |
|
|
172
|
+
| ---------- | ----- | -------- | -------------------------------------------------- |
|
|
173
|
+
| `model_id` | `str` | Yes | Target model identifier |
|
|
174
|
+
| `text` | `str` | No | Text input |
|
|
175
|
+
| `image` | `str` | No | Base64 image input |
|
|
176
|
+
|
|
177
|
+
Notes:
|
|
178
|
+
|
|
179
|
+
- Exactly one input is required: `text` or `image`
|
|
180
|
+
|
|
181
|
+
Returns:
|
|
182
|
+
|
|
183
|
+
- `list[float]` or `list[list[float]]`
|
|
184
|
+
|
|
185
|
+
### `client.generate_text(model_id, prompt, image=None, images=None, videos=None)`
|
|
186
|
+
|
|
187
|
+
| Parameter | Type | Required | Description |
|
|
188
|
+
| ---------- | -------------------- | -------- | ------------------------------------- |
|
|
189
|
+
| `model_id` | `str` | Yes | Target model identifier |
|
|
190
|
+
| `prompt` | `str` | Yes | Text prompt |
|
|
191
|
+
| `image` | `str` | No | Single base64 image |
|
|
192
|
+
| `images` | `str` or `list[str]` | No | Base64 image(s) |
|
|
193
|
+
| `videos` | `str` or `list[str]` | No | Video URL(s) or base64 video input(s) |
|
|
194
|
+
|
|
195
|
+
Returns:
|
|
196
|
+
|
|
197
|
+
- `str`
|
|
198
|
+
|
|
199
|
+
### `client.analyze(model_id, text=None, images=None, videos=None)`
|
|
200
|
+
|
|
201
|
+
| Parameter | Type | Required | Description |
|
|
202
|
+
| ---------- | -------------------- | -------- | ------------------------------------- |
|
|
203
|
+
| `model_id` | `str` | Yes | Target model identifier |
|
|
204
|
+
| `text` | `str` | No | Text input |
|
|
205
|
+
| `images` | `str` or `list[str]` | No | Base64 image(s) |
|
|
206
|
+
| `videos` | `str` or `list[str]` | No | Video URL(s) or base64 video input(s) |
|
|
207
|
+
|
|
208
|
+
Notes:
|
|
209
|
+
|
|
210
|
+
- At least one input is required: `text` or `images` or `videos`
|
|
211
|
+
|
|
212
|
+
Returns:
|
|
213
|
+
|
|
214
|
+
- `str`
|
|
215
|
+
|
|
216
|
+
### `client.generate_image(model_id, prompt)`
|
|
217
|
+
|
|
218
|
+
| Parameter | Type | Required | Description |
|
|
219
|
+
| ---------- | ----- | -------- | ----------------------- |
|
|
220
|
+
| `model_id` | `str` | Yes | Target model identifier |
|
|
221
|
+
| `prompt` | `str` | Yes | Text prompt |
|
|
222
|
+
|
|
223
|
+
Returns:
|
|
224
|
+
|
|
225
|
+
- `str` (generated image URL, empty string if unavailable)
|
|
226
|
+
|
|
227
|
+
### `client.generate_3d(model_id, image=None, prompt=None)`
|
|
228
|
+
|
|
229
|
+
| Parameter | Type | Required | Description |
|
|
230
|
+
| ---------- | ----- | -------- | ------------------------------------------ |
|
|
231
|
+
| `model_id` | `str` | Yes | Target model identifier |
|
|
232
|
+
| `image` | `str` | No | Base64 image input |
|
|
233
|
+
| `prompt` | `str` | No | Optional prompt input |
|
|
234
|
+
|
|
235
|
+
Notes:
|
|
236
|
+
|
|
237
|
+
- Provide at least one input: `image` or `prompt`
|
|
238
|
+
|
|
239
|
+
Returns:
|
|
240
|
+
|
|
241
|
+
- `str` (3D asset URL, empty string if unavailable)
|
|
242
|
+
|
|
243
|
+
## Input Validation
|
|
244
|
+
|
|
245
|
+
- `model_id` is required for all inference methods.
|
|
246
|
+
- `task_type` is never required from user.
|
|
247
|
+
- `image` and `images` must be base64-encoded strings when provided.
|
|
248
|
+
- Unsupported fields for selected model are rejected before request dispatch.
|
|
249
|
+
- Missing required fields for selected model are rejected before request dispatch.
|
|
250
|
+
|
|
251
|
+
## Contract
|
|
252
|
+
|
|
253
|
+
Frozen contract file is included in repository.
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=68", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "neuralhive"
|
|
7
|
+
version = "1.0.1"
|
|
8
|
+
authors = [
|
|
9
|
+
{ name="Muhammad Khazq", email="mrkhaziq.dev@gmail.com" },
|
|
10
|
+
]
|
|
11
|
+
description = "NeuralHive Python SDK for model access and inference"
|
|
12
|
+
readme = "README.md"
|
|
13
|
+
requires-python = ">=3.9"
|
|
14
|
+
dependencies = [
|
|
15
|
+
"requests>=2.31.0",
|
|
16
|
+
]
|
|
17
|
+
classifiers = [
|
|
18
|
+
"Programming Language :: Python :: 3",
|
|
19
|
+
"Operating System :: OS Independent",
|
|
20
|
+
]
|
|
21
|
+
license = "MIT"
|
|
22
|
+
license-files = ["LICEN[CS]E*"]
|
|
23
|
+
|
|
24
|
+
[project.optional-dependencies]
|
|
25
|
+
dev = [
|
|
26
|
+
"mypy>=1.19.1",
|
|
27
|
+
]
|
|
28
|
+
|
|
29
|
+
[project.urls]
|
|
30
|
+
Homepage = "https://neuralhive.ai"
|
|
31
|
+
|
|
32
|
+
[project.scripts]
|
|
33
|
+
neuralhive = "neuralhive.cli:main"
|
|
34
|
+
|
|
35
|
+
[tool.setuptools]
|
|
36
|
+
package-dir = {"" = "src"}
|
|
37
|
+
include-package-data = false
|
|
38
|
+
|
|
39
|
+
[tool.setuptools.packages.find]
|
|
40
|
+
where = ["src"]
|
|
41
|
+
include = ["neuralhive*"]
|
|
42
|
+
|
|
43
|
+
[tool.mypy]
|
|
44
|
+
python_version = "3.9"
|
|
45
|
+
files = ["src"]
|
|
46
|
+
pretty = true
|
|
47
|
+
show_error_codes = true
|
|
48
|
+
warn_return_any = true
|
|
49
|
+
warn_unused_ignores = true
|
|
50
|
+
disallow_untyped_defs = true
|
|
51
|
+
disallow_incomplete_defs = true
|
|
52
|
+
no_implicit_optional = true
|
|
53
|
+
check_untyped_defs = true
|
|
54
|
+
strict_equality = true
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
from .client import Client
|
|
2
|
+
|
|
3
|
+
__all__ = ["Client"]
|
|
4
|
+
|
|
5
|
+
# Keep package root surface minimal (Client-only).
|
|
6
|
+
for _private_name in ("clip_embeddings", "object_detection", "person_reid", "text_embeddings", "slm", "sam3", "face_recognition", "face_detection", "three_d_asset_generation", "pose_estimation", "instance_segmentation", "vlm", "models"):
|
|
7
|
+
globals().pop(_private_name, None)
|
|
8
|
+
del _private_name
|