runapi-muse-video 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_muse_video-0.3.0/PKG-INFO +20 -0
- runapi_muse_video-0.3.0/README.md +3 -0
- runapi_muse_video-0.3.0/pyproject.toml +34 -0
- runapi_muse_video-0.3.0/src/runapi/muse_video/__init__.py +6 -0
- runapi_muse_video-0.3.0/src/runapi/muse_video/client.py +16 -0
- runapi_muse_video-0.3.0/src/runapi/muse_video/py.typed +0 -0
- runapi_muse_video-0.3.0/src/runapi/muse_video/resources/__init__.py +6 -0
- runapi_muse_video-0.3.0/src/runapi/muse_video/resources/image_to_video.py +21 -0
- runapi_muse_video-0.3.0/src/runapi/muse_video/resources/text_to_video.py +21 -0
- runapi_muse_video-0.3.0/tests/test_client.py +32 -0
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: runapi-muse-video
|
|
3
|
+
Version: 0.3.0
|
|
4
|
+
Summary: RunAPI Muse Video SDK for text-to-video and single-image-to-video workflows in JavaScript, Python, Ruby, Go, and Java
|
|
5
|
+
Project-URL: Homepage, https://runapi.ai/models/muse-video
|
|
6
|
+
Project-URL: Documentation, https://runapi.ai/docs/resources/sdks
|
|
7
|
+
Project-URL: Source, https://github.com/runapi-ai/muse-video-sdk
|
|
8
|
+
Project-URL: Issues, https://github.com/runapi-ai/muse-video-sdk/issues
|
|
9
|
+
Project-URL: Changelog, https://github.com/runapi-ai/muse-video-sdk/blob/main/CHANGELOG.md
|
|
10
|
+
Project-URL: Release Notes, https://github.com/runapi-ai/muse-video-sdk/releases/tag/python%2Fv0.3.0
|
|
11
|
+
Author-email: RunAPI <contact@runapi.ai>
|
|
12
|
+
License-Expression: Apache-2.0
|
|
13
|
+
Keywords: api,golang,gradle,image-to-video,java,maven,muse-video,python,ruby,runapi,runapi-ai,sdk,text-to-video,typescript,video-generation
|
|
14
|
+
Requires-Python: >=3.10
|
|
15
|
+
Requires-Dist: runapi-core~=0.12.0
|
|
16
|
+
Description-Content-Type: text/markdown
|
|
17
|
+
|
|
18
|
+
# RunAPI Muse Video Python SDK
|
|
19
|
+
|
|
20
|
+
Generate videos from text prompts or a source image with the RunAPI API.
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "runapi-muse-video"
|
|
7
|
+
version = "0.3.0"
|
|
8
|
+
description = "RunAPI Muse Video SDK for text-to-video and single-image-to-video workflows in JavaScript, Python, Ruby, Go, and Java"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.10"
|
|
11
|
+
license = "Apache-2.0"
|
|
12
|
+
authors = [{ name = "RunAPI", email = "contact@runapi.ai" }]
|
|
13
|
+
keywords = ["runapi", "runapi-ai", "muse-video", "api", "sdk", "typescript", "python", "ruby", "golang", "java", "maven", "gradle", "video-generation", "text-to-video", "image-to-video"]
|
|
14
|
+
dependencies = ["runapi-core~=0.12.0"]
|
|
15
|
+
|
|
16
|
+
[project.urls]
|
|
17
|
+
Homepage = "https://runapi.ai/models/muse-video"
|
|
18
|
+
Documentation = "https://runapi.ai/docs/resources/sdks"
|
|
19
|
+
Source = "https://github.com/runapi-ai/muse-video-sdk"
|
|
20
|
+
Issues = "https://github.com/runapi-ai/muse-video-sdk/issues"
|
|
21
|
+
Changelog = "https://github.com/runapi-ai/muse-video-sdk/blob/main/CHANGELOG.md"
|
|
22
|
+
"Release Notes" = "https://github.com/runapi-ai/muse-video-sdk/releases/tag/python%2Fv0.3.0"
|
|
23
|
+
|
|
24
|
+
[tool.hatch.build.targets.wheel]
|
|
25
|
+
packages = ["src/runapi"]
|
|
26
|
+
|
|
27
|
+
[tool.uv]
|
|
28
|
+
package = true
|
|
29
|
+
|
|
30
|
+
[dependency-groups]
|
|
31
|
+
dev = ["pytest>=8"]
|
|
32
|
+
|
|
33
|
+
[tool.runapi]
|
|
34
|
+
slug = "muse-video"
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"""Muse Video client."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from typing import Any, Optional
|
|
6
|
+
from runapi.core import ProviderClient
|
|
7
|
+
from .resources import ImageToVideo, TextToVideo
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class MuseVideoClient(ProviderClient):
|
|
11
|
+
"""Text-to-video and image-to-video API client."""
|
|
12
|
+
|
|
13
|
+
def __init__(self, api_key: Optional[str] = None, **options: Any) -> None:
|
|
14
|
+
super().__init__(api_key, **options)
|
|
15
|
+
self.text_to_video = TextToVideo(self._http)
|
|
16
|
+
self.image_to_video = ImageToVideo(self._http)
|
|
File without changes
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"""Image-to-video resource."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
from typing import Any, Optional
|
|
5
|
+
from runapi.core import Resource, RequestOptions
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class ImageToVideo(Resource):
|
|
9
|
+
"""Animate a source image with a text prompt."""
|
|
10
|
+
|
|
11
|
+
ENDPOINT = "/api/v1/muse_video/image_to_video"
|
|
12
|
+
|
|
13
|
+
def create(self, options: Optional[RequestOptions] = None, **params: Any) -> Any:
|
|
14
|
+
return self._request("post", self.ENDPOINT, body=self._compact_params(params), options=options)
|
|
15
|
+
|
|
16
|
+
def get(self, id: str, options: Optional[RequestOptions] = None) -> Any:
|
|
17
|
+
return self._request("get", f"{self.ENDPOINT}/{id}", options=options)
|
|
18
|
+
|
|
19
|
+
def run(self, options: Optional[RequestOptions] = None, **params: Any) -> Any:
|
|
20
|
+
task = self.create(options=options, **params)
|
|
21
|
+
return self._poll_until_complete(lambda: self.get(task.id, options=options))
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"""Text-to-video resource."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
from typing import Any, Optional
|
|
5
|
+
from runapi.core import Resource, RequestOptions
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class TextToVideo(Resource):
|
|
9
|
+
"""Generate a video from a text prompt."""
|
|
10
|
+
|
|
11
|
+
ENDPOINT = "/api/v1/muse_video/text_to_video"
|
|
12
|
+
|
|
13
|
+
def create(self, options: Optional[RequestOptions] = None, **params: Any) -> Any:
|
|
14
|
+
return self._request("post", self.ENDPOINT, body=self._compact_params(params), options=options)
|
|
15
|
+
|
|
16
|
+
def get(self, id: str, options: Optional[RequestOptions] = None) -> Any:
|
|
17
|
+
return self._request("get", f"{self.ENDPOINT}/{id}", options=options)
|
|
18
|
+
|
|
19
|
+
def run(self, options: Optional[RequestOptions] = None, **params: Any) -> Any:
|
|
20
|
+
task = self.create(options=options, **params)
|
|
21
|
+
return self._poll_until_complete(lambda: self.get(task.id, options=options))
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
from runapi.muse_video.resources.image_to_video import ImageToVideo
|
|
2
|
+
from runapi.muse_video.resources.text_to_video import TextToVideo
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
class StubHttp:
|
|
6
|
+
def __init__(self):
|
|
7
|
+
self.calls = []
|
|
8
|
+
|
|
9
|
+
def request(self, method, path, **kwargs):
|
|
10
|
+
self.calls.append((method, path, kwargs))
|
|
11
|
+
return {"id": "task-1", "status": "processing"}
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def test_text_to_video_create_and_get():
|
|
15
|
+
http = StubHttp()
|
|
16
|
+
resource = TextToVideo(http)
|
|
17
|
+
resource.create(model="muse-video-v1", prompt="A city at dawn")
|
|
18
|
+
assert http.calls[-1] == (
|
|
19
|
+
"post",
|
|
20
|
+
"/api/v1/muse_video/text_to_video",
|
|
21
|
+
{"body": {"model": "muse-video-v1", "prompt": "A city at dawn"}, "options": None},
|
|
22
|
+
)
|
|
23
|
+
resource.get("task-1")
|
|
24
|
+
assert http.calls[-1][1] == "/api/v1/muse_video/text_to_video/task-1"
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def test_image_to_video_posts_source_image():
|
|
28
|
+
http = StubHttp()
|
|
29
|
+
resource = ImageToVideo(http)
|
|
30
|
+
resource.create(model="muse-video-v1", prompt="Animate", image_url="https://cdn.runapi.ai/public/samples/image.jpg")
|
|
31
|
+
assert http.calls[-1][1] == "/api/v1/muse_video/image_to_video"
|
|
32
|
+
assert http.calls[-1][2]["body"]["image_url"].endswith("image.jpg")
|