vikit.gateways.vikit_gateway

Overview

Classes

VikitGateway

A Gateway to interact with the Vikit API

Classes

class vikit.gateways.vikit_gateway.VikitGateway(vikit_api_key: str = None)

Bases: vikit.gateways.ML_models_gateway.MLModelsGateway

A Gateway to interact with the Vikit API

Overview

Methods

add_part_gemini(data_to_add, data_kind, valid_data_extensions)

-

ask_gemini(prompt, gemini_version, more_contents)

Prompts Google Gemini model

compose_music_from_text_async(prompt_text, duration)

Compose a music for a prompt text

convert_image_to_b64(image, target_size)

-

generate_background_music_async(duration, prompt)

Here we generate the music to add as background music

generate_mp3_from_text_async(prompt_text, target_file)

-

generate_mp3_from_text_async_elevenlabs(prompt_text, target_file)

Generate an mp3 file from a text prompt.

generate_seine_transition_async(source_image_path, target_image_path)

Generate a transition between two videos

generate_video_DynamiCrafter_image_async(prompt)

Generate a video from the given prompt

generate_video_VideoCrafter2_async(prompt)

Generate a video from the given prompt

generate_video_async(prompt, model_provider, aspect_ratio)

Generate a video from the given prompt

generate_video_from_image_and_text_runway(prompt, aspect_ratio)

Generate a video from the given image prompt

generate_video_from_image_stabilityai_async(prompt, aspect_ratio)

Generate a video from the given image prompt

generate_video_haiper_async(prompt, aspect_ratio)

Generate a video from the given prompt

generate_video_stabilityai_async(prompt, aspect_ratio)

Generate a video from the given prompt

get_enhanced_prompt_async(subtitleText)

Generates an enhanced prompt from an original one, probably written by a user or

get_keywords_from_prompt_async(subtitleText, excluded_words)

Generates keywords from a subtitle text using the Replicate API.

get_music_generation_keywords_async(text)

Generate keywords from a text using the Replicate API

get_sendable_image(image, aspect_ratio)

-

get_subtitles_async(audiofile_path)

Extract subtitles from an audio file using the Replicate API

interpolate_async(video)

Run some interpolation magic. This model may fail after timeout, so you

Members

add_part_gemini(data_to_add, data_kind, valid_data_extensions)
async ask_gemini(prompt, gemini_version='gemini-1.5-pro-002', more_contents=None)

Prompts Google Gemini model

Parameters:
  • prompt -- The Prompt to query Gemini on

  • gemini_version -- the version of gemini we want to use

  • more_contents -- To get more precise answers, an array of a conversation we want to simulate with gemini after the prompt, in the form

  • [{ --

    “role”: “model”, “parts”: [

    {

    “text”: “I do not agree”

    }

    ]

  • }

:param : :param {: “role”: “user”,

“parts”: [
{

“text”: “Ok, what would be another point of view ?”

}

]

Parameters:
  • }

  • ]

Returns:

The link to the generated video

async compose_music_from_text_async(prompt_text: str, duration: int)

Compose a music for a prompt text

Parameters:
  • prompt_text -- The text prompt

  • duration -- The duration of the music

Returns:

The link to the generated music

convert_image_to_b64(image, target_size=None)
async generate_background_music_async(duration: int = 3, prompt: str = None) str

Here we generate the music to add as background music

Parameters:
  • duration (-) -- int - the duration of the music in seconds

  • prompt (-) -- str - the prompt to generate the music from

Returns:

the path to the generated music

Return type:

  • str

async generate_mp3_from_text_async(prompt_text: str, target_file: str)
async generate_mp3_from_text_async_elevenlabs(prompt_text: str, target_file: str)

Generate an mp3 file from a text prompt.

Parameters:
  • prompt_text (-) -- str - the text to generate the mp3 from

  • target_file (-) -- str - the path to the target file

Returns:

  • None

async generate_seine_transition_async(source_image_path, target_image_path)

Generate a transition between two videos

Parameters:
  • index -- The index of the video

  • initial -- Whether this is the initial video

Returns:

The link to the generated video

async generate_video_DynamiCrafter_image_async(prompt)

Generate a video from the given prompt

Parameters:

prompt -- The prompt to generate the video from

Returns:

The link to the generated video

async generate_video_VideoCrafter2_async(prompt)

Generate a video from the given prompt

Parameters:

prompt -- The prompt to generate the video from

Returns:

The link to the generated video

async generate_video_async(prompt, model_provider: str, aspect_ratio=(16, 9))

Generate a video from the given prompt

Parameters:
  • prompt -- The prompt to generate the video from

  • model_provider -- The model provider to use

Returns:

The path to the generated video

async generate_video_from_image_and_text_runway(prompt, aspect_ratio=(16, 9))

Generate a video from the given image prompt

Parameters:

prompt -- Image prompt to generate the video from in base64 format

Returns:

The link to the generated video

async generate_video_from_image_stabilityai_async(prompt, aspect_ratio)

Generate a video from the given image prompt

Parameters:

prompt -- Prompt containing an image attribe

Returns:

The link to the generated video

async generate_video_haiper_async(prompt, aspect_ratio)

Generate a video from the given prompt

Parameters:

prompt -- The prompt to generate the video from

Returns:

The link to the generated video

async generate_video_stabilityai_async(prompt, aspect_ratio)

Generate a video from the given prompt

Parameters:

prompt -- The prompt to generate the video from

Returns:

The link to the generated video

async get_enhanced_prompt_async(subtitleText)

Generates an enhanced prompt from an original one, probably written by a user or translated from an audio

Parameters:

text (A subtitle)

Returns:

A prompt enhanced by an LLM

async get_keywords_from_prompt_async(subtitleText, excluded_words: str = None)

Generates keywords from a subtitle text using the Replicate API.

Parameters:

text (A subtitle)

Returns:

A list of keywords generated by an LLM using the subtitle text

async get_music_generation_keywords_async(text) str

Generate keywords from a text using the Replicate API

At the end of the resulting prompt we get 3 words that will be used to generate a file name out of the generated keywords

Parameters:

text -- The text to generate keywords from

Returns:

A list of keywords

get_sendable_image(image, aspect_ratio)
async get_subtitles_async(audiofile_path)

Extract subtitles from an audio file using the Replicate API

Parameters:

i (int) -- The index of the audio slice

Returns:

The subtitles obtained from the Replicate API

Return type:

subs

async interpolate_async(video)

Run some interpolation magic. This model may fail after timeout, so you should call it with retry logic

Parameters:

video -- The video to interpolate

Returns:

a link to the interpolated video

Attributes

vikit.gateways.vikit_gateway.KEYWORDS_FORMAT_PROMPT = "' Just list the keywords in english language, separated by a coma, do not re-output the prompt....
vikit.gateways.vikit_gateway.VALID_AUDIO_EXTENSIONS = ['.mp3', '.wav', '.aiff', '.aac', '.ogg', '.flac']
vikit.gateways.vikit_gateway.VALID_IMAGE_EXTENSIONS = ['.png', '.jpg', '.jpeg', '.bmp', '.tiff', '.webp']
vikit.gateways.vikit_gateway.VALID_VIDEO_EXTENSIONS = ['.mp4', '.mov', '.avi', '.wmv', '.webm']
vikit.gateways.vikit_gateway.http_timeout
vikit.gateways.vikit_gateway.mistral_version = 'meta/meta-llama-3-70b-instruct'
vikit.gateways.vikit_gateway.vikit_backend_url