Restyle video with text prompts
import { createDecartClient, models } from "@decartai/sdk";
const model = models.realtime("lucy-restyle-2");
// Get user's camera stream with model specifications
const stream = await navigator.mediaDevices.getUserMedia({
audio: true,
video: {
frameRate: model.fps,
width: model.width,
height: model.height,
}
});
// Create a client
const client = createDecartClient({
apiKey: "your-api-key-here"
});
// Connect and transform the video stream
const realtimeClient = await client.realtime.connect(stream, {
model,
mirror: "auto",
onRemoteStream: (transformedStream) => {
// Display the transformed video
const videoElement = document.querySelector("#video-output");
videoElement.srcObject = transformedStream;
}
});
// Change the style on the fly
await realtimeClient.setPrompt("Cyberpunk city");
// Disconnect when done
realtimeClient.disconnect();promptRequiredStyle transformation description
streamRequiredVideo stream (WebRTC)
promptstringYesStyle transformation descriptionstreamFileYesVideo stream (WebRTC)Restyle video in realtime
Lucy Restyle is a zero-latency, autoregressive video model - generating video infinitely and in real time. It allows restyling of any video, instantly adapts to input and keeps temporal coherence.
Video models are charged per second of generated video. Final cost depends on video duration and selected resolution.