Skip to content

Commit b65fb22

Browse files
authored
feat: remove deprecated generation models from SDK (#42)
* Remove deprecated generation models * Refine editing-focused prompts and docs
1 parent 1aebb9a commit b65fb22

File tree

15 files changed

+166
-463
lines changed

15 files changed

+166
-463
lines changed

README.md

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ For complete documentation, guides, and examples, visit:
2323

2424
## Quick Start
2525

26-
### Process Files
26+
### Image Editing (Process API)
2727

2828
```python
2929
import asyncio
@@ -32,29 +32,30 @@ from decart import DecartClient, models
3232

3333
async def main():
3434
async with DecartClient(api_key=os.getenv("DECART_API_KEY")) as client:
35-
# Generate a video from text
35+
# Edit an image
3636
result = await client.process({
37-
"model": models.video("lucy-pro-t2v"),
38-
"prompt": "A cat walking in a lego world",
37+
"model": models.image("lucy-pro-i2i"),
38+
"prompt": "Apply a painterly oil-on-canvas look while preserving the composition",
39+
"data": open("input.png", "rb"),
3940
})
4041

41-
# Save the result
42-
with open("output.mp4", "wb") as f:
42+
with open("output.png", "wb") as f:
4343
f.write(result)
4444

4545
asyncio.run(main())
4646
```
4747

48-
### Async Processing (Queue API)
48+
### Video Editing (Queue API)
4949

50-
For video generation jobs, use the queue API to submit jobs and poll for results:
50+
For video editing jobs, use the queue API to submit jobs and poll for results:
5151

5252
```python
5353
async with DecartClient(api_key=os.getenv("DECART_API_KEY")) as client:
5454
# Submit and poll automatically
5555
result = await client.queue.submit_and_poll({
56-
"model": models.video("lucy-pro-t2v"),
57-
"prompt": "A cat playing piano",
56+
"model": models.video("lucy-pro-v2v"),
57+
"prompt": "Restyle this footage with anime shading and vibrant neon highlights",
58+
"data": open("input.mp4", "rb"),
5859
"on_status_change": lambda job: print(f"Status: {job.status}"),
5960
})
6061

@@ -71,8 +72,9 @@ Or manage the polling manually:
7172
async with DecartClient(api_key=os.getenv("DECART_API_KEY")) as client:
7273
# Submit the job
7374
job = await client.queue.submit({
74-
"model": models.video("lucy-pro-t2v"),
75-
"prompt": "A cat playing piano",
75+
"model": models.video("lucy-pro-v2v"),
76+
"prompt": "Add cinematic teal-and-orange grading and gentle film grain",
77+
"data": open("input.mp4", "rb"),
7678
})
7779
print(f"Job ID: {job.job_id}")
7880

@@ -147,8 +149,8 @@ python test_ui.py
147149
Then open http://localhost:7860 in your browser.
148150

149151
The UI provides tabs for:
150-
- **Image Generation** - Text-to-image and image-to-image transformations
151-
- **Video Generation** - Text-to-video, image-to-video, and video-to-video
152+
- **Image Editing** - Image-to-image edits
153+
- **Video Editing** - Video-to-video edits
152154
- **Video Restyle** - Restyle videos using text prompts or reference images
153155
- **Tokens** - Create short-lived client tokens
154156

decart/client.py

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
class DecartClient:
2121
"""
22-
Decart API client for video and image generation/transformation.
22+
Decart API client for image editing, video editing, and realtime workflows.
2323
2424
Args:
2525
api_key: Your Decart API key. Defaults to the DECART_API_KEY environment variable.
@@ -35,16 +35,18 @@ class DecartClient:
3535
# Option 2: Using DECART_API_KEY environment variable
3636
client = DecartClient()
3737
38-
# Image generation (sync) - use process()
38+
# Image editing (sync) - use process()
3939
image = await client.process({
40-
"model": models.image("lucy-pro-t2i"),
41-
"prompt": "A serene lake at sunset",
40+
"model": models.image("lucy-pro-i2i"),
41+
"prompt": "Apply a painterly oil-on-canvas look while preserving the composition",
42+
"data": open("input.png", "rb"),
4243
})
4344
44-
# Video generation (async) - use queue
45+
# Video editing (async) - use queue
4546
result = await client.queue.submit_and_poll({
46-
"model": models.video("lucy-pro-t2v"),
47-
"prompt": "A serene lake at sunset",
47+
"model": models.video("lucy-pro-v2v"),
48+
"prompt": "Restyle this footage with anime shading and vibrant neon highlights",
49+
"data": open("input.mp4", "rb"),
4850
})
4951
```
5052
"""
@@ -75,15 +77,16 @@ def __init__(
7577
@property
7678
def queue(self) -> QueueClient:
7779
"""
78-
Queue client for async job-based video generation.
80+
Queue client for async video editing jobs.
7981
Only video models support the queue API.
8082
8183
Example:
8284
```python
8385
# Submit and poll automatically
8486
result = await client.queue.submit_and_poll({
85-
"model": models.video("lucy-pro-t2v"),
86-
"prompt": "A cat playing piano",
87+
"model": models.video("lucy-pro-v2v"),
88+
"prompt": "Restyle this footage with anime shading and vibrant neon highlights",
89+
"data": open("input.mp4", "rb"),
8790
})
8891
8992
# Or submit and poll manually
@@ -135,16 +138,16 @@ async def __aexit__(self, exc_type, exc_val, exc_tb):
135138

136139
async def process(self, options: dict[str, Any]) -> bytes:
137140
"""
138-
Process image generation/transformation synchronously.
141+
Process image editing synchronously.
139142
Only image models support the process API.
140143
141-
For video generation, use the queue API instead:
144+
For video editing, use the queue API instead:
142145
result = await client.queue.submit_and_poll({...})
143146
144147
Args:
145148
options: Processing options including model and inputs
146149
- model: ImageModelDefinition from models.image()
147-
- prompt: Text prompt for generation
150+
- prompt: Text instructions describing the requested edit
148151
- Additional model-specific inputs
149152
150153
Returns:

decart/models.py

Lines changed: 1 addition & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,12 @@
66

77
RealTimeModels = Literal["mirage", "mirage_v2", "lucy_v2v_720p_rt", "lucy_2_rt", "live_avatar"]
88
VideoModels = Literal[
9-
"lucy-dev-i2v",
10-
"lucy-fast-v2v",
11-
"lucy-pro-t2v",
12-
"lucy-pro-i2v",
139
"lucy-pro-v2v",
1410
"lucy-motion",
1511
"lucy-restyle-v2v",
1612
"lucy-2-v2v",
1713
]
18-
ImageModels = Literal["lucy-pro-t2i", "lucy-pro-i2i"]
14+
ImageModels = Literal["lucy-pro-i2i"]
1915
Model = Literal[RealTimeModels, VideoModels, ImageModels]
2016

2117
# Type variable for model name
@@ -46,24 +42,6 @@ class ModelDefinition(DecartBaseModel, Generic[ModelT]):
4642
"""Type alias for model definitions that support realtime streaming."""
4743

4844

49-
class TextToVideoInput(BaseModel):
50-
prompt: str = Field(..., min_length=1, max_length=1000)
51-
seed: Optional[int] = None
52-
resolution: Optional[str] = None
53-
orientation: Optional[str] = None
54-
55-
56-
class ImageToVideoInput(DecartBaseModel):
57-
prompt: str = Field(
58-
...,
59-
min_length=1,
60-
max_length=1000,
61-
)
62-
data: FileInput
63-
seed: Optional[int] = None
64-
resolution: Optional[str] = None
65-
66-
6745
class VideoToVideoInput(DecartBaseModel):
6846
prompt: str = Field(
6947
...,
@@ -128,17 +106,6 @@ class VideoEdit2Input(DecartBaseModel):
128106
enhance_prompt: Optional[bool] = None
129107

130108

131-
class TextToImageInput(BaseModel):
132-
prompt: str = Field(
133-
...,
134-
min_length=1,
135-
max_length=1000,
136-
)
137-
seed: Optional[int] = None
138-
resolution: Optional[str] = None
139-
orientation: Optional[str] = None
140-
141-
142109
class ImageToImageInput(DecartBaseModel):
143110
prompt: str = Field(
144111
...,
@@ -195,38 +162,6 @@ class ImageToImageInput(DecartBaseModel):
195162
),
196163
},
197164
"video": {
198-
"lucy-dev-i2v": ModelDefinition(
199-
name="lucy-dev-i2v",
200-
url_path="/v1/generate/lucy-dev-i2v",
201-
fps=25,
202-
width=1280,
203-
height=704,
204-
input_schema=ImageToVideoInput,
205-
),
206-
"lucy-fast-v2v": ModelDefinition(
207-
name="lucy-fast-v2v",
208-
url_path="/v1/generate/lucy-fast-v2v",
209-
fps=25,
210-
width=1280,
211-
height=704,
212-
input_schema=VideoToVideoInput,
213-
),
214-
"lucy-pro-t2v": ModelDefinition(
215-
name="lucy-pro-t2v",
216-
url_path="/v1/generate/lucy-pro-t2v",
217-
fps=25,
218-
width=1280,
219-
height=704,
220-
input_schema=TextToVideoInput,
221-
),
222-
"lucy-pro-i2v": ModelDefinition(
223-
name="lucy-pro-i2v",
224-
url_path="/v1/generate/lucy-pro-i2v",
225-
fps=25,
226-
width=1280,
227-
height=704,
228-
input_schema=ImageToVideoInput,
229-
),
230165
"lucy-pro-v2v": ModelDefinition(
231166
name="lucy-pro-v2v",
232167
url_path="/v1/generate/lucy-pro-v2v",
@@ -261,14 +196,6 @@ class ImageToImageInput(DecartBaseModel):
261196
),
262197
},
263198
"image": {
264-
"lucy-pro-t2i": ModelDefinition(
265-
name="lucy-pro-t2i",
266-
url_path="/v1/generate/lucy-pro-t2i",
267-
fps=25,
268-
width=1280,
269-
height=704,
270-
input_schema=TextToImageInput,
271-
),
272199
"lucy-pro-i2i": ModelDefinition(
273200
name="lucy-pro-i2i",
274201
url_path="/v1/generate/lucy-pro-i2i",
@@ -297,11 +224,7 @@ def video(model: VideoModels) -> VideoModelDefinition:
297224
Video models only support the queue API.
298225
299226
Available models:
300-
- "lucy-pro-t2v" - Text-to-video
301-
- "lucy-pro-i2v" - Image-to-video
302227
- "lucy-pro-v2v" - Video-to-video
303-
- "lucy-dev-i2v" - Image-to-video (Dev quality)
304-
- "lucy-fast-v2v" - Video-to-video (Fast quality)
305228
- "lucy-motion" - Image-to-motion-video
306229
- "lucy-restyle-v2v" - Video-to-video with prompt or reference image
307230
- "lucy-2-v2v" - Video-to-video editing (long-form, 720p)
@@ -318,7 +241,6 @@ def image(model: ImageModels) -> ImageModelDefinition:
318241
Image models only support the process (sync) API.
319242
320243
Available models:
321-
- "lucy-pro-t2i" - Text-to-image
322244
- "lucy-pro-i2i" - Image-to-image
323245
"""
324246
try:

decart/queue/client.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525

2626
class QueueClient:
2727
"""
28-
Queue client for async job-based video generation.
28+
Queue client for async job-based video editing.
2929
Only video models support the queue API.
3030
3131
Jobs are submitted and processed asynchronously, allowing you to
@@ -37,15 +37,17 @@ class QueueClient:
3737
3838
# Option 1: Submit and poll automatically
3939
result = await client.queue.submit_and_poll({
40-
"model": models.video("lucy-pro-t2v"),
41-
"prompt": "A cat playing piano",
40+
"model": models.video("lucy-pro-v2v"),
41+
"prompt": "Restyle this clip with anime shading and saturated colors",
42+
"data": open("input.mp4", "rb"),
4243
"on_status_change": lambda job: print(f"Status: {job.status}"),
4344
})
4445
4546
# Option 2: Submit and poll manually
4647
job = await client.queue.submit({
47-
"model": models.video("lucy-pro-t2v"),
48-
"prompt": "A cat playing piano",
48+
"model": models.video("lucy-pro-v2v"),
49+
"prompt": "Add cinematic teal-and-orange grading and subtle film grain",
50+
"data": open("input.mp4", "rb"),
4951
})
5052
status = await client.queue.status(job.job_id)
5153
result = await client.queue.result(job.job_id)
@@ -60,14 +62,14 @@ async def _get_session(self) -> aiohttp.ClientSession:
6062

6163
async def submit(self, options: dict[str, Any]) -> JobSubmitResponse:
6264
"""
63-
Submit a video generation job to the queue for async processing.
65+
Submit a video editing job to the queue for async processing.
6466
Only video models are supported.
6567
Returns immediately with job_id and initial status.
6668
6769
Args:
6870
options: Submit options including model and inputs
6971
- model: VideoModelDefinition from models.video()
70-
- prompt: Text prompt for generation
72+
- prompt: Text instructions describing the requested edit
7173
- Additional model-specific inputs
7274
7375
Returns:

examples/README.md

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,10 @@ export DECART_API_KEY="your-api-key-here"
2020

2121
### Process API
2222

23-
- **`process_video.py`** - Generate and transform videos
24-
- **`process_image.py`** - Generate and transform images
23+
- **`process_video.py`** - Edit a local video with `lucy-pro-v2v`
24+
- **`process_image.py`** - Edit the bundled example image with `lucy-pro-i2i`
2525
- **`process_url.py`** - Transform videos from URLs
26+
- **`queue_image_example.py`** - Turn the bundled example image into motion with `lucy-motion`
2627

2728
### Realtime API
2829

@@ -37,13 +38,19 @@ pip install decart[realtime]
3738

3839
### Running Examples
3940

41+
`process_image.py` and `queue_image_example.py` use the bundled `examples/files/image.png` asset.
42+
`process_video.py` expects you to place a local video at `examples/assets/example_video.mp4` first.
43+
4044
```bash
41-
# Generate and transform videos
45+
# Edit a local video (requires examples/assets/example_video.mp4)
4246
python examples/process_video.py
4347

44-
# Generate and transform images
48+
# Edit the bundled example image
4549
python examples/process_image.py
4650

51+
# Turn the bundled example image into motion
52+
python examples/queue_image_example.py
53+
4754
# Transform video from URL
4855
python examples/process_url.py
4956

0 commit comments

Comments
 (0)