Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions decart/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
VideoModels = Literal[
"lucy-dev-i2v",
"lucy-dev-v2v",
"lucy-fast-v2v",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's add a test?

"lucy-pro-t2v",
"lucy-pro-i2v",
"lucy-pro-v2v",
Expand Down Expand Up @@ -148,6 +149,14 @@ class ImageToImageInput(DecartBaseModel):
height=704,
input_schema=VideoToVideoInput,
),
"lucy-fast-v2v": ModelDefinition(
name="lucy-fast-v2v",
url_path="/v1/generate/lucy-fast-v2v",
fps=25,
width=1280,
height=704,
input_schema=VideoToVideoInput,
),
"lucy-pro-t2v": ModelDefinition(
name="lucy-pro-t2v",
url_path="/v1/generate/lucy-pro-t2v",
Expand Down
33 changes: 33 additions & 0 deletions tests/test_process.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,39 @@ async def test_process_video_to_video() -> None:
assert result == b"fake video data"


@pytest.mark.asyncio
async def test_process_video_to_video_fast() -> None:
client = DecartClient(api_key="test-key")

with patch("aiohttp.ClientSession") as mock_session_cls:
mock_response = MagicMock()
mock_response.ok = True
mock_response.read = AsyncMock(return_value=b"fake video data")

mock_session = MagicMock()
mock_session.__aenter__ = AsyncMock(return_value=mock_session)
mock_session.__aexit__ = AsyncMock(return_value=None)
mock_session.post = MagicMock()
mock_session.post.return_value.__aenter__ = AsyncMock(return_value=mock_response)
mock_session.post.return_value.__aexit__ = AsyncMock(return_value=None)

mock_session_cls.return_value = mock_session

result = await client.process(
{
"model": models.video("lucy-fast-v2v"),
"prompt": "Change the car to a motorcycle",
"data": b"fake input video",
"resolution": "480p",
"enhance_prompt": True,
"num_inference_steps": 50,
"seed": 42,
}
)

assert result == b"fake video data"


@pytest.mark.asyncio
async def test_process_max_prompt_length() -> None:
client = DecartClient(api_key="test-key")
Expand Down
Loading