runapi-volcengine-lip-sync 0.1.1__py3-none-any.whl
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/volcengine_lip_sync/__init__.py +24 -0
- runapi/volcengine_lip_sync/client.py +19 -0
- runapi/volcengine_lip_sync/contract_gen.py +38 -0
- runapi/volcengine_lip_sync/py.typed +1 -0
- runapi/volcengine_lip_sync/resources/__init__.py +3 -0
- runapi/volcengine_lip_sync/resources/lip_sync_video.py +34 -0
- runapi/volcengine_lip_sync/types.py +26 -0
- runapi_volcengine_lip_sync-0.1.1.dist-info/METADATA +53 -0
- runapi_volcengine_lip_sync-0.1.1.dist-info/RECORD +10 -0
- runapi_volcengine_lip_sync-0.1.1.dist-info/WHEEL +4 -0
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"""Volcengine Lip Sync client for RunAPI."""
|
|
2
|
+
|
|
3
|
+
from runapi.core import (
|
|
4
|
+
AuthenticationError,
|
|
5
|
+
InsufficientCreditsError,
|
|
6
|
+
NotFoundError,
|
|
7
|
+
RateLimitError,
|
|
8
|
+
TaskFailedError,
|
|
9
|
+
TaskTimeoutError,
|
|
10
|
+
ValidationError,
|
|
11
|
+
)
|
|
12
|
+
|
|
13
|
+
from .client import VolcengineLipSyncClient
|
|
14
|
+
|
|
15
|
+
__all__ = [
|
|
16
|
+
"VolcengineLipSyncClient",
|
|
17
|
+
"AuthenticationError",
|
|
18
|
+
"RateLimitError",
|
|
19
|
+
"InsufficientCreditsError",
|
|
20
|
+
"NotFoundError",
|
|
21
|
+
"ValidationError",
|
|
22
|
+
"TaskFailedError",
|
|
23
|
+
"TaskTimeoutError",
|
|
24
|
+
]
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"""Volcengine Lip Sync client."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from typing import Any, Optional
|
|
6
|
+
|
|
7
|
+
from runapi.core import ClientOptions, HttpClient, resolve_api_key
|
|
8
|
+
|
|
9
|
+
from .resources.lip_sync_video import LipSyncVideo
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class VolcengineLipSyncClient:
|
|
13
|
+
"""Volcengine Lip Sync client."""
|
|
14
|
+
|
|
15
|
+
def __init__(self, api_key: Optional[str] = None, **options: Any) -> None:
|
|
16
|
+
resolved_api_key = resolve_api_key(api_key)
|
|
17
|
+
client_options = ClientOptions(api_key=resolved_api_key, **options)
|
|
18
|
+
http = client_options.http_client or HttpClient(client_options)
|
|
19
|
+
self.lip_sync_video = LipSyncVideo(http)
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
CONTRACT = {
|
|
2
|
+
"lip-sync-video": {
|
|
3
|
+
"models": ["volcengine-lip-sync"],
|
|
4
|
+
"fields_by_model": {
|
|
5
|
+
"volcengine-lip-sync": {
|
|
6
|
+
"mode": {
|
|
7
|
+
"enum": ["lite", "basic"],
|
|
8
|
+
"required": True
|
|
9
|
+
},
|
|
10
|
+
"source_audio_url": {
|
|
11
|
+
"required": True
|
|
12
|
+
},
|
|
13
|
+
"source_video_url": {
|
|
14
|
+
"required": True
|
|
15
|
+
},
|
|
16
|
+
"template_start_seconds": {
|
|
17
|
+
"min": 0
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
"rules": [{
|
|
22
|
+
"when": {
|
|
23
|
+
"mode": "lite"
|
|
24
|
+
},
|
|
25
|
+
"forbidden": ["enable_scene_detection"]
|
|
26
|
+
}, {
|
|
27
|
+
"when": {
|
|
28
|
+
"mode": "basic"
|
|
29
|
+
},
|
|
30
|
+
"forbidden": ["align_audio", "align_audio_reverse", "template_start_seconds"]
|
|
31
|
+
}, {
|
|
32
|
+
"when": {
|
|
33
|
+
"align_audio_reverse": True
|
|
34
|
+
},
|
|
35
|
+
"required": ["align_audio"]
|
|
36
|
+
}]
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"""Volcengine Lip Sync video resource."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from typing import Any, Optional
|
|
6
|
+
|
|
7
|
+
from runapi.core import Resource, RequestOptions
|
|
8
|
+
|
|
9
|
+
from ..contract_gen import CONTRACT
|
|
10
|
+
from ..types import CompletedLipSyncVideoResponse, LipSyncVideoResponse
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class LipSyncVideo(Resource):
|
|
14
|
+
"""Drive a source video's lip movement from an audio track."""
|
|
15
|
+
|
|
16
|
+
ENDPOINT = "/api/v1/volcengine_lip_sync/lip_sync_video"
|
|
17
|
+
|
|
18
|
+
RESPONSE_CLASS = LipSyncVideoResponse
|
|
19
|
+
COMPLETED_RESPONSE_CLASS = CompletedLipSyncVideoResponse
|
|
20
|
+
|
|
21
|
+
def run(self, options: Optional[RequestOptions] = None, **params: Any) -> Any:
|
|
22
|
+
"""Create a task and poll until it completes."""
|
|
23
|
+
task = self.create(options=options, **params)
|
|
24
|
+
return self._poll_until_complete(lambda: self.get(task.id, options=options))
|
|
25
|
+
|
|
26
|
+
def create(self, options: Optional[RequestOptions] = None, **params: Any) -> Any:
|
|
27
|
+
"""Create a lip-sync video task and return immediately with an ``id``."""
|
|
28
|
+
compacted = self._compact_params(params)
|
|
29
|
+
self._validate_contract(CONTRACT["lip-sync-video"], compacted)
|
|
30
|
+
return self._request("post", self.ENDPOINT, body=compacted, options=options)
|
|
31
|
+
|
|
32
|
+
def get(self, id: str, options: Optional[RequestOptions] = None) -> Any:
|
|
33
|
+
"""Fetch the current status of a lip-sync video task."""
|
|
34
|
+
return self._request("get", f"{self.ENDPOINT}/{id}", options=options)
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"""Volcengine Lip Sync response models."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from runapi.core import BaseModel, TaskResponse, optional, required
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class Video(BaseModel):
|
|
9
|
+
"""A generated video reference."""
|
|
10
|
+
|
|
11
|
+
url = optional(str)
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
class LipSyncVideoResponse(TaskResponse):
|
|
15
|
+
"""Response for a lip-sync video task."""
|
|
16
|
+
|
|
17
|
+
id = required(str)
|
|
18
|
+
status = optional(str, enum=lambda: TaskResponse.Status.ALL)
|
|
19
|
+
videos = optional([lambda: Video])
|
|
20
|
+
error = optional(str)
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
class CompletedLipSyncVideoResponse(LipSyncVideoResponse):
|
|
24
|
+
"""Returned by ``lip_sync_video.run()`` once polling observes completion."""
|
|
25
|
+
|
|
26
|
+
videos = required([lambda: Video])
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: runapi-volcengine-lip-sync
|
|
3
|
+
Version: 0.1.1
|
|
4
|
+
Summary: RunAPI Volcengine Lip Sync SDK for audio-driven video-to-video lip sync workflows in JavaScript, Python, Ruby, Go, Java, and PHP
|
|
5
|
+
Project-URL: Homepage, https://runapi.ai/models/volcengine-lip-sync
|
|
6
|
+
Project-URL: Documentation, https://runapi.ai/docs#sdk-volcengine-lip-sync
|
|
7
|
+
Project-URL: Source, https://github.com/runapi-ai/volcengine-lip-sync-sdk
|
|
8
|
+
Project-URL: Issues, https://github.com/runapi-ai/volcengine-lip-sync-sdk/issues
|
|
9
|
+
Author-email: RunAPI <contact@runapi.ai>
|
|
10
|
+
License-Expression: Apache-2.0
|
|
11
|
+
Keywords: api,golang,gradle,java,lip-sync,lip-sync-api,maven,python,ruby,runapi,runapi-ai,sdk,typescript,video-api,video-generation,volcengine
|
|
12
|
+
Requires-Python: >=3.9
|
|
13
|
+
Requires-Dist: runapi-core>=0.1.4
|
|
14
|
+
Description-Content-Type: text/markdown
|
|
15
|
+
|
|
16
|
+
# Volcengine Lip Sync API Python SDK for RunAPI
|
|
17
|
+
|
|
18
|
+
The Volcengine Lip Sync Python SDK submits lip-sync video tasks and retrieves task results through RunAPI.
|
|
19
|
+
|
|
20
|
+
## Install
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
pip install runapi-volcengine-lip-sync
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Quick start
|
|
27
|
+
|
|
28
|
+
```python
|
|
29
|
+
from runapi.volcengine_lip_sync import VolcengineLipSyncClient
|
|
30
|
+
|
|
31
|
+
client = VolcengineLipSyncClient()
|
|
32
|
+
task = client.lip_sync_video.create(
|
|
33
|
+
model="volcengine-lip-sync",
|
|
34
|
+
mode="lite",
|
|
35
|
+
source_video_url="https://cdn.runapi.ai/public/samples/volcengine-lip-sync-source.mp4",
|
|
36
|
+
source_audio_url="https://cdn.runapi.ai/public/samples/volcengine-lip-sync-voice-adam.mp3",
|
|
37
|
+
)
|
|
38
|
+
status = client.lip_sync_video.get(task.id)
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
Use `create`, `get`, and `run` for async workflows. Keep `RUNAPI_API_KEY` in the environment or your secret manager.
|
|
42
|
+
|
|
43
|
+
## Links
|
|
44
|
+
|
|
45
|
+
- Model page: https://runapi.ai/models/volcengine-lip-sync
|
|
46
|
+
- SDK docs: https://runapi.ai/docs#sdk-volcengine-lip-sync
|
|
47
|
+
- Product docs: https://runapi.ai/docs#volcengine-lip-sync
|
|
48
|
+
- Pricing and rate limits: https://runapi.ai/models/volcengine-lip-sync
|
|
49
|
+
- Repository: https://github.com/runapi-ai/volcengine-lip-sync-sdk
|
|
50
|
+
|
|
51
|
+
## License
|
|
52
|
+
|
|
53
|
+
Licensed under the Apache License, Version 2.0.
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
runapi/volcengine_lip_sync/__init__.py,sha256=F9nQqtgsqICSt85wVE7VqNTky1epL3o5Z0RZASl7_WY,495
|
|
2
|
+
runapi/volcengine_lip_sync/client.py,sha256=0dmgwQYDpbC86hcXSizoPQkaj3mKEzIxt-HOyFTd5co,624
|
|
3
|
+
runapi/volcengine_lip_sync/contract_gen.py,sha256=YlBcZuNJ8OPlJxu3nOJJv8-bdow9wYungPluaw9ZCoM,1044
|
|
4
|
+
runapi/volcengine_lip_sync/py.typed,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
|
|
5
|
+
runapi/volcengine_lip_sync/types.py,sha256=8cFV2P_zyVnOpn2ey-pBgA31PliAn8ZO7Qq9DBHjoyc,664
|
|
6
|
+
runapi/volcengine_lip_sync/resources/__init__.py,sha256=uNLVAjqWg190qZb4eQmfTbXGiRLAfiSGrscRUBjTQ-E,69
|
|
7
|
+
runapi/volcengine_lip_sync/resources/lip_sync_video.py,sha256=alqbqt0tEU8-RaG6sNKmko1aQDUA9wnD1m9Lj-k7ZJc,1410
|
|
8
|
+
runapi_volcengine_lip_sync-0.1.1.dist-info/METADATA,sha256=LPZQGUheNcvOVcWxHOlJ6I2Ce5N2xDuOY95bTmP6V3U,1996
|
|
9
|
+
runapi_volcengine_lip_sync-0.1.1.dist-info/WHEEL,sha256=lCkmxWfQsSc9CfIClYeavTdQeEX2toPqufh9gI35EQA,87
|
|
10
|
+
runapi_volcengine_lip_sync-0.1.1.dist-info/RECORD,,
|