runapi-omnihuman 0.2.1__tar.gz → 0.3.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.
- {runapi_omnihuman-0.2.1 → runapi_omnihuman-0.3.0}/PKG-INFO +4 -4
- {runapi_omnihuman-0.2.1 → runapi_omnihuman-0.3.0}/pyproject.toml +3 -3
- {runapi_omnihuman-0.2.1 → runapi_omnihuman-0.3.0}/src/runapi/omnihuman/resources/audio_to_video.py +1 -6
- {runapi_omnihuman-0.2.1 → runapi_omnihuman-0.3.0}/src/runapi/omnihuman/resources/human_identification.py +1 -6
- {runapi_omnihuman-0.2.1 → runapi_omnihuman-0.3.0}/src/runapi/omnihuman/resources/subject_detection.py +1 -6
- {runapi_omnihuman-0.2.1 → runapi_omnihuman-0.3.0}/tests/test_client.py +10 -28
- runapi_omnihuman-0.2.1/src/runapi/omnihuman/contract_gen.py +0 -48
- {runapi_omnihuman-0.2.1 → runapi_omnihuman-0.3.0}/README.md +0 -0
- {runapi_omnihuman-0.2.1 → runapi_omnihuman-0.3.0}/src/runapi/omnihuman/__init__.py +0 -0
- {runapi_omnihuman-0.2.1 → runapi_omnihuman-0.3.0}/src/runapi/omnihuman/client.py +0 -0
- {runapi_omnihuman-0.2.1 → runapi_omnihuman-0.3.0}/src/runapi/omnihuman/py.typed +0 -0
- {runapi_omnihuman-0.2.1 → runapi_omnihuman-0.3.0}/src/runapi/omnihuman/resources/__init__.py +0 -0
- {runapi_omnihuman-0.2.1 → runapi_omnihuman-0.3.0}/src/runapi/omnihuman/types.py +0 -0
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
2
|
Name: runapi-omnihuman
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.3.0
|
|
4
4
|
Summary: RunAPI OmniHuman SDK for audio-to-video and image helper workflows in JavaScript, Python, Ruby, Go, Java, and PHP
|
|
5
5
|
Project-URL: Homepage, https://runapi.ai/models/omnihuman
|
|
6
6
|
Project-URL: Documentation, https://runapi.ai/docs/resources/sdks
|
|
7
7
|
Project-URL: Source, https://github.com/runapi-ai/omnihuman-sdk
|
|
8
8
|
Project-URL: Issues, https://github.com/runapi-ai/omnihuman-sdk/issues
|
|
9
9
|
Project-URL: Changelog, https://github.com/runapi-ai/omnihuman-sdk/blob/main/CHANGELOG.md
|
|
10
|
-
Project-URL: Release Notes, https://github.com/runapi-ai/omnihuman-sdk/releases/tag/python%2Fv0.
|
|
10
|
+
Project-URL: Release Notes, https://github.com/runapi-ai/omnihuman-sdk/releases/tag/python%2Fv0.3.0
|
|
11
11
|
Author-email: RunAPI <contact@runapi.ai>
|
|
12
12
|
License-Expression: Apache-2.0
|
|
13
13
|
Keywords: api,audio-to-video,golang,gradle,java,maven,omnihuman,omnihuman-api,python,ruby,runapi,runapi-ai,sdk,typescript,video-api,video-generation
|
|
14
14
|
Requires-Python: >=3.9
|
|
15
|
-
Requires-Dist: runapi-core
|
|
15
|
+
Requires-Dist: runapi-core~=0.10.0
|
|
16
16
|
Description-Content-Type: text/markdown
|
|
17
17
|
|
|
18
18
|
# OmniHuman Python SDK for RunAPI
|
|
@@ -4,14 +4,14 @@ build-backend = "hatchling.build"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "runapi-omnihuman"
|
|
7
|
-
version = "0.
|
|
7
|
+
version = "0.3.0"
|
|
8
8
|
description = "RunAPI OmniHuman SDK for audio-to-video and image helper workflows in JavaScript, Python, Ruby, Go, Java, and PHP"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.9"
|
|
11
11
|
license = "Apache-2.0"
|
|
12
12
|
authors = [{ name = "RunAPI", email = "contact@runapi.ai" }]
|
|
13
13
|
keywords = ["runapi", "runapi-ai", "omnihuman", "api", "sdk", "typescript", "python", "ruby", "golang", "java", "maven", "gradle", "video-generation", "audio-to-video", "video-api", "omnihuman-api"]
|
|
14
|
-
dependencies = ["runapi-core
|
|
14
|
+
dependencies = ["runapi-core~=0.10.0"]
|
|
15
15
|
|
|
16
16
|
[project.urls]
|
|
17
17
|
Homepage = "https://runapi.ai/models/omnihuman"
|
|
@@ -19,7 +19,7 @@ Documentation = "https://runapi.ai/docs/resources/sdks"
|
|
|
19
19
|
Source = "https://github.com/runapi-ai/omnihuman-sdk"
|
|
20
20
|
Issues = "https://github.com/runapi-ai/omnihuman-sdk/issues"
|
|
21
21
|
Changelog = "https://github.com/runapi-ai/omnihuman-sdk/blob/main/CHANGELOG.md"
|
|
22
|
-
"Release Notes" = "https://github.com/runapi-ai/omnihuman-sdk/releases/tag/python%2Fv0.
|
|
22
|
+
"Release Notes" = "https://github.com/runapi-ai/omnihuman-sdk/releases/tag/python%2Fv0.3.0"
|
|
23
23
|
|
|
24
24
|
[tool.hatch.build.targets.wheel]
|
|
25
25
|
packages = ["src/runapi"]
|
{runapi_omnihuman-0.2.1 → runapi_omnihuman-0.3.0}/src/runapi/omnihuman/resources/audio_to_video.py
RENAMED
|
@@ -2,11 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
|
-
from typing import Any,
|
|
5
|
+
from typing import Any, Optional
|
|
6
6
|
|
|
7
7
|
from runapi.core import Resource, RequestOptions
|
|
8
8
|
|
|
9
|
-
from ..contract_gen import CONTRACT
|
|
10
9
|
from ..types import (
|
|
11
10
|
AudioToVideoResponse,
|
|
12
11
|
CompletedAudioToVideoResponse,
|
|
@@ -28,12 +27,8 @@ class AudioToVideo(Resource):
|
|
|
28
27
|
def create(self, options: Optional[RequestOptions] = None, **params: Any) -> Any:
|
|
29
28
|
"""Create an audio-to-video task and return immediately with an ``id``."""
|
|
30
29
|
compacted = self._compact_params(params)
|
|
31
|
-
self._validate_params(compacted)
|
|
32
30
|
return self._request("post", self.ENDPOINT, body=compacted, options=options)
|
|
33
31
|
|
|
34
32
|
def get(self, id: str, options: Optional[RequestOptions] = None) -> Any:
|
|
35
33
|
"""Fetch the current status of an audio-to-video task."""
|
|
36
34
|
return self._request("get", f"{self.ENDPOINT}/{id}", options=options)
|
|
37
|
-
|
|
38
|
-
def _validate_params(self, params: Dict[str, Any]) -> None:
|
|
39
|
-
self._validate_contract(CONTRACT["audio-to-video"], params)
|
|
@@ -2,11 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
|
-
from typing import Any,
|
|
5
|
+
from typing import Any, Optional
|
|
6
6
|
|
|
7
7
|
from runapi.core import Resource, RequestOptions
|
|
8
8
|
|
|
9
|
-
from ..contract_gen import CONTRACT
|
|
10
9
|
from ..types import (
|
|
11
10
|
CompletedHumanIdentificationResponse,
|
|
12
11
|
HumanIdentificationResponse,
|
|
@@ -29,12 +28,8 @@ class HumanIdentification(Resource):
|
|
|
29
28
|
def create(self, options: Optional[RequestOptions] = None, **params: Any) -> Any:
|
|
30
29
|
"""Create a human-identification task and return immediately with an ``id``."""
|
|
31
30
|
compacted = self._compact_params(params)
|
|
32
|
-
self._validate_params(compacted)
|
|
33
31
|
return self._request("post", self.ENDPOINT, body=compacted, options=options)
|
|
34
32
|
|
|
35
33
|
def get(self, id: str, options: Optional[RequestOptions] = None) -> Any:
|
|
36
34
|
"""Fetch the current status of a human-identification task."""
|
|
37
35
|
return self._request("get", f"{self.ENDPOINT}/{id}", options=options)
|
|
38
|
-
|
|
39
|
-
def _validate_params(self, params: Dict[str, Any]) -> None:
|
|
40
|
-
self._validate_contract(CONTRACT["human-identification"], params)
|
|
@@ -2,11 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
|
-
from typing import Any,
|
|
5
|
+
from typing import Any, Optional
|
|
6
6
|
|
|
7
7
|
from runapi.core import Resource, RequestOptions
|
|
8
8
|
|
|
9
|
-
from ..contract_gen import CONTRACT
|
|
10
9
|
from ..types import (
|
|
11
10
|
CompletedSubjectDetectionResponse,
|
|
12
11
|
SubjectDetectionResponse,
|
|
@@ -29,12 +28,8 @@ class SubjectDetection(Resource):
|
|
|
29
28
|
def create(self, options: Optional[RequestOptions] = None, **params: Any) -> Any:
|
|
30
29
|
"""Create a subject-detection task and return immediately with an ``id``."""
|
|
31
30
|
compacted = self._compact_params(params)
|
|
32
|
-
self._validate_params(compacted)
|
|
33
31
|
return self._request("post", self.ENDPOINT, body=compacted, options=options)
|
|
34
32
|
|
|
35
33
|
def get(self, id: str, options: Optional[RequestOptions] = None) -> Any:
|
|
36
34
|
"""Fetch the current status of a subject-detection task."""
|
|
37
35
|
return self._request("get", f"{self.ENDPOINT}/{id}", options=options)
|
|
38
|
-
|
|
39
|
-
def _validate_params(self, params: Dict[str, Any]) -> None:
|
|
40
|
-
self._validate_contract(CONTRACT["subject-detection"], params)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import pytest
|
|
2
2
|
|
|
3
3
|
from runapi.core import config
|
|
4
|
-
from runapi.core.errors import AuthenticationError
|
|
4
|
+
from runapi.core.errors import AuthenticationError
|
|
5
5
|
from runapi.omnihuman import OmnihumanClient
|
|
6
6
|
from runapi.omnihuman.resources.audio_to_video import AudioToVideo
|
|
7
7
|
from runapi.omnihuman.resources.human_identification import HumanIdentification
|
|
@@ -92,10 +92,8 @@ def test_audio_to_video_create_posts_compacted_body():
|
|
|
92
92
|
"source_audio_url": "https://cdn.runapi.ai/public/samples/voice.mp3",
|
|
93
93
|
"prompt": "A presenter speaks naturally to camera",
|
|
94
94
|
"output_resolution": "720p",
|
|
95
|
-
"enable_fast_mode": True,
|
|
96
|
-
|
|
97
|
-
),
|
|
98
|
-
]
|
|
95
|
+
"enable_fast_mode": True},
|
|
96
|
+
)]
|
|
99
97
|
assert isinstance(result, AudioToVideoResponse)
|
|
100
98
|
assert result.id == "t1"
|
|
101
99
|
|
|
@@ -110,7 +108,7 @@ def test_audio_to_video_get_fetches_by_id():
|
|
|
110
108
|
def test_audio_to_video_run_polls_and_narrows_completed_type():
|
|
111
109
|
fake = FakeHttp(
|
|
112
110
|
{"id": "t1", "status": "pending"},
|
|
113
|
-
{"id": "t1", "status": "completed", "videos": [{"url": "https://x/y.mp4"}]},
|
|
111
|
+
{"id": "t1", "status": "completed", "usage": {"cost": 0.05}, "videos": [{"url": "https://x/y.mp4"}]},
|
|
114
112
|
)
|
|
115
113
|
client = OmnihumanClient(api_key="k", http_client=fake)
|
|
116
114
|
result = client.audio_to_video.run(**VALID_AUDIO_PARAMS)
|
|
@@ -123,7 +121,7 @@ def test_audio_to_video_run_polls_and_narrows_completed_type():
|
|
|
123
121
|
def test_human_identification_create_and_get():
|
|
124
122
|
fake = FakeHttp(
|
|
125
123
|
{"id": "human_1", "status": "pending"},
|
|
126
|
-
{"id": "human_1", "status": "completed", "subject_status": 1},
|
|
124
|
+
{"id": "human_1", "status": "completed", "usage": {"cost": 0.05}, "subject_status": 1},
|
|
127
125
|
)
|
|
128
126
|
client = OmnihumanClient(api_key="k", http_client=fake)
|
|
129
127
|
task = client.human_identification.create(
|
|
@@ -137,8 +135,7 @@ def test_human_identification_create_and_get():
|
|
|
137
135
|
"/api/v1/omnihuman/human_identification",
|
|
138
136
|
{
|
|
139
137
|
"model": "omnihuman-1.5-human-identification",
|
|
140
|
-
"source_image_url": "https://cdn.runapi.ai/public/samples/portrait.jpg",
|
|
141
|
-
},
|
|
138
|
+
"source_image_url": "https://cdn.runapi.ai/public/samples/portrait.jpg"},
|
|
142
139
|
)
|
|
143
140
|
assert fake.calls[1] == ("get", "/api/v1/omnihuman/human_identification/human_1", None)
|
|
144
141
|
assert isinstance(result, HumanIdentificationResponse)
|
|
@@ -148,7 +145,7 @@ def test_human_identification_create_and_get():
|
|
|
148
145
|
def test_human_identification_run_polls_and_narrows_completed_type():
|
|
149
146
|
fake = FakeHttp(
|
|
150
147
|
{"id": "human_1", "status": "pending"},
|
|
151
|
-
{"id": "human_1", "status": "completed", "subject_status": 1},
|
|
148
|
+
{"id": "human_1", "status": "completed", "usage": {"cost": 0.05}, "subject_status": 1},
|
|
152
149
|
)
|
|
153
150
|
client = OmnihumanClient(api_key="k", http_client=fake)
|
|
154
151
|
result = client.human_identification.run(
|
|
@@ -163,7 +160,7 @@ def test_human_identification_run_polls_and_narrows_completed_type():
|
|
|
163
160
|
def test_subject_detection_create_and_get():
|
|
164
161
|
fake = FakeHttp(
|
|
165
162
|
{"id": "mask_1", "status": "pending"},
|
|
166
|
-
{"id": "mask_1", "status": "completed", "masks": [{"url": "https://x/mask.png"}]},
|
|
163
|
+
{"id": "mask_1", "status": "completed", "usage": {"cost": 0.05}, "masks": [{"url": "https://x/mask.png"}]},
|
|
167
164
|
)
|
|
168
165
|
client = OmnihumanClient(api_key="k", http_client=fake)
|
|
169
166
|
task = client.subject_detection.create(
|
|
@@ -177,8 +174,7 @@ def test_subject_detection_create_and_get():
|
|
|
177
174
|
"/api/v1/omnihuman/subject_detection",
|
|
178
175
|
{
|
|
179
176
|
"model": "omnihuman-1.5-subject-detection",
|
|
180
|
-
"source_image_url": "https://cdn.runapi.ai/public/samples/portrait.jpg",
|
|
181
|
-
},
|
|
177
|
+
"source_image_url": "https://cdn.runapi.ai/public/samples/portrait.jpg"},
|
|
182
178
|
)
|
|
183
179
|
assert fake.calls[1] == ("get", "/api/v1/omnihuman/subject_detection/mask_1", None)
|
|
184
180
|
assert isinstance(result, SubjectDetectionResponse)
|
|
@@ -188,7 +184,7 @@ def test_subject_detection_create_and_get():
|
|
|
188
184
|
def test_subject_detection_run_polls_and_narrows_completed_type():
|
|
189
185
|
fake = FakeHttp(
|
|
190
186
|
{"id": "mask_1", "status": "pending"},
|
|
191
|
-
{"id": "mask_1", "status": "completed", "masks": [{"url": "https://x/mask.png"}]},
|
|
187
|
+
{"id": "mask_1", "status": "completed", "usage": {"cost": 0.05}, "masks": [{"url": "https://x/mask.png"}]},
|
|
192
188
|
)
|
|
193
189
|
client = OmnihumanClient(api_key="k", http_client=fake)
|
|
194
190
|
result = client.subject_detection.run(
|
|
@@ -198,17 +194,3 @@ def test_subject_detection_run_polls_and_narrows_completed_type():
|
|
|
198
194
|
|
|
199
195
|
assert isinstance(result, CompletedSubjectDetectionResponse)
|
|
200
196
|
assert result.masks[0].url == "https://x/mask.png"
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
def test_audio_to_video_requires_model():
|
|
204
|
-
client = OmnihumanClient(api_key="k", http_client=FakeHttp())
|
|
205
|
-
params = {k: v for k, v in VALID_AUDIO_PARAMS.items() if k != "model"}
|
|
206
|
-
with pytest.raises(ValidationError, match="model must be one of: omnihuman-1.5"):
|
|
207
|
-
client.audio_to_video.create(**params)
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
def test_audio_to_video_rejects_invalid_resolution():
|
|
211
|
-
client = OmnihumanClient(api_key="k", http_client=FakeHttp())
|
|
212
|
-
params = {**VALID_AUDIO_PARAMS, "output_resolution": "480p"}
|
|
213
|
-
with pytest.raises(ValidationError, match="output_resolution must be one of: 720p, 1080p"):
|
|
214
|
-
client.audio_to_video.create(**params)
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
CONTRACT = {
|
|
2
|
-
"audio-to-video": {
|
|
3
|
-
"models": ["omnihuman-1.5"],
|
|
4
|
-
"fields_by_model": {
|
|
5
|
-
"omnihuman-1.5": {
|
|
6
|
-
"mask_urls": {
|
|
7
|
-
"max_items": 5
|
|
8
|
-
},
|
|
9
|
-
"output_resolution": {
|
|
10
|
-
"enum": ["720p", "1080p"]
|
|
11
|
-
},
|
|
12
|
-
"prompt": {
|
|
13
|
-
"max": 1000,
|
|
14
|
-
"length": True
|
|
15
|
-
},
|
|
16
|
-
"seed": {
|
|
17
|
-
"type": "integer"
|
|
18
|
-
},
|
|
19
|
-
"source_audio_url": {
|
|
20
|
-
"required": True
|
|
21
|
-
},
|
|
22
|
-
"source_image_url": {
|
|
23
|
-
"required": True
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
},
|
|
28
|
-
"human-identification": {
|
|
29
|
-
"models": ["omnihuman-1.5-human-identification"],
|
|
30
|
-
"fields_by_model": {
|
|
31
|
-
"omnihuman-1.5-human-identification": {
|
|
32
|
-
"source_image_url": {
|
|
33
|
-
"required": True
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
},
|
|
38
|
-
"subject-detection": {
|
|
39
|
-
"models": ["omnihuman-1.5-subject-detection"],
|
|
40
|
-
"fields_by_model": {
|
|
41
|
-
"omnihuman-1.5-subject-detection": {
|
|
42
|
-
"source_image_url": {
|
|
43
|
-
"required": True
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{runapi_omnihuman-0.2.1 → runapi_omnihuman-0.3.0}/src/runapi/omnihuman/resources/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|