Skip to content

Commit 5433ee6

Browse files
authored
Chore: Add Lucy Edit fast (#10)
* Chore: Add Lucy Edit fast * Chore: Add tests for new fast model
1 parent 36021e0 commit 5433ee6

2 files changed

Lines changed: 42 additions & 0 deletions

File tree

decart/models.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
VideoModels = Literal[
99
"lucy-dev-i2v",
1010
"lucy-dev-v2v",
11+
"lucy-fast-v2v",
1112
"lucy-pro-t2v",
1213
"lucy-pro-i2v",
1314
"lucy-pro-v2v",
@@ -148,6 +149,14 @@ class ImageToImageInput(DecartBaseModel):
148149
height=704,
149150
input_schema=VideoToVideoInput,
150151
),
152+
"lucy-fast-v2v": ModelDefinition(
153+
name="lucy-fast-v2v",
154+
url_path="/v1/generate/lucy-fast-v2v",
155+
fps=25,
156+
width=1280,
157+
height=704,
158+
input_schema=VideoToVideoInput,
159+
),
151160
"lucy-pro-t2v": ModelDefinition(
152161
name="lucy-pro-t2v",
153162
url_path="/v1/generate/lucy-pro-t2v",

tests/test_process.py

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,39 @@ async def test_process_video_to_video() -> None:
8787
assert result == b"fake video data"
8888

8989

90+
@pytest.mark.asyncio
91+
async def test_process_video_to_video_fast() -> None:
92+
client = DecartClient(api_key="test-key")
93+
94+
with patch("aiohttp.ClientSession") as mock_session_cls:
95+
mock_response = MagicMock()
96+
mock_response.ok = True
97+
mock_response.read = AsyncMock(return_value=b"fake video data")
98+
99+
mock_session = MagicMock()
100+
mock_session.__aenter__ = AsyncMock(return_value=mock_session)
101+
mock_session.__aexit__ = AsyncMock(return_value=None)
102+
mock_session.post = MagicMock()
103+
mock_session.post.return_value.__aenter__ = AsyncMock(return_value=mock_response)
104+
mock_session.post.return_value.__aexit__ = AsyncMock(return_value=None)
105+
106+
mock_session_cls.return_value = mock_session
107+
108+
result = await client.process(
109+
{
110+
"model": models.video("lucy-fast-v2v"),
111+
"prompt": "Change the car to a motorcycle",
112+
"data": b"fake input video",
113+
"resolution": "480p",
114+
"enhance_prompt": True,
115+
"num_inference_steps": 50,
116+
"seed": 42,
117+
}
118+
)
119+
120+
assert result == b"fake video data"
121+
122+
90123
@pytest.mark.asyncio
91124
async def test_process_max_prompt_length() -> None:
92125
client = DecartClient(api_key="test-key")

0 commit comments

Comments
 (0)