File tree Expand file tree Collapse file tree 1 file changed +39
-0
lines changed Expand file tree Collapse file tree 1 file changed +39
-0
lines changed Original file line number Diff line number Diff line change @@ -270,6 +270,45 @@ def generate_voice(
270
270
if audio_data :
271
271
return Audio (self ._connection , ** audio_data )
272
272
273
+ def generate_video (
274
+ self ,
275
+ prompt : str ,
276
+ duration : float ,
277
+ callback_url : Optional [str ] = None ,
278
+ ) -> Video :
279
+ """
280
+ Generate a video from the given text prompt.
281
+
282
+ This method sends a request to generate a video using the provided prompt,
283
+ duration. If a callback URL is provided, the generation result will be sent to that endpoint asynchronously.
284
+
285
+ :param str prompt: Text prompt used as input for video generation.
286
+
287
+ :param float duration:
288
+ Duration of the generated video in seconds.
289
+ Must be an **integer value** (not a float) and must be **between 5 and 8 inclusive**.
290
+ A `ValueError` will be raised if the validation fails.
291
+
292
+ :param str callback_url:
293
+ Optional URL to receive a callback once video generation is complete.
294
+
295
+ :return:
296
+ A `Video` object containing the generated video metadata and access details.
297
+
298
+ :rtype:
299
+ :class:`videodb.video.Video`
300
+ """
301
+ video_data = self ._connection .post (
302
+ path = f"{ ApiPath .collection } /{ self .id } /{ ApiPath .generate } /{ ApiPath .video } " ,
303
+ data = {
304
+ "prompt" : prompt ,
305
+ "duration" : duration ,
306
+ "callback_url" : callback_url ,
307
+ },
308
+ )
309
+ if video_data :
310
+ return Video (self ._connection , ** video_data )
311
+
273
312
def dub_video (
274
313
self , video_id : str , language_code : str , callback_url : Optional [str ] = None
275
314
) -> Video :
You can’t perform that action at this time.
0 commit comments