vikit.gateways.vikit_gateway ============================ .. py:module:: vikit.gateways.vikit_gateway Overview -------- .. list-table:: Classes :header-rows: 0 :widths: auto :class: summarytable * - :py:obj:`VikitGateway ` - A Gateway to interact with the Vikit API .. list-table:: Attributes :header-rows: 0 :widths: auto :class: summarytable * - :py:obj:`KEYWORDS_FORMAT_PROMPT ` - \- * - :py:obj:`VALID_AUDIO_EXTENSIONS ` - \- * - :py:obj:`VALID_IMAGE_EXTENSIONS ` - \- * - :py:obj:`VALID_VIDEO_EXTENSIONS ` - \- * - :py:obj:`http_timeout ` - \- * - :py:obj:`mistral_version ` - \- * - :py:obj:`vikit_backend_url ` - \- Classes ------- .. py:class:: VikitGateway(vikit_api_key: str = None) Bases: :py:obj:`vikit.gateways.ML_models_gateway.MLModelsGateway` A Gateway to interact with the Vikit API .. rubric:: Overview .. list-table:: Methods :header-rows: 0 :widths: auto :class: summarytable * - :py:obj:`add_part_gemini `\ (data_to_add, data_kind, valid_data_extensions) - \- * - :py:obj:`ask_gemini `\ (prompt, gemini_version, more_contents) - Prompts Google Gemini model * - :py:obj:`compose_music_from_text_async `\ (prompt_text, duration) - Compose a music for a prompt text * - :py:obj:`convert_image_to_b64 `\ (image, target_size) - \- * - :py:obj:`generate_background_music_async `\ (duration, prompt) - Here we generate the music to add as background music * - :py:obj:`generate_mp3_from_text_async `\ (prompt_text, target_file) - \- * - :py:obj:`generate_mp3_from_text_async_elevenlabs `\ (prompt_text, target_file) - Generate an mp3 file from a text prompt. * - :py:obj:`generate_seine_transition_async `\ (source_image_path, target_image_path) - Generate a transition between two videos * - :py:obj:`generate_video_DynamiCrafter_image_async `\ (prompt) - Generate a video from the given prompt * - :py:obj:`generate_video_VideoCrafter2_async `\ (prompt) - Generate a video from the given prompt * - :py:obj:`generate_video_async `\ (prompt, model_provider, aspect_ratio) - Generate a video from the given prompt * - :py:obj:`generate_video_from_image_and_text_runway `\ (prompt, aspect_ratio) - Generate a video from the given image prompt * - :py:obj:`generate_video_from_image_stabilityai_async `\ (prompt, aspect_ratio) - Generate a video from the given image prompt * - :py:obj:`generate_video_haiper_async `\ (prompt, aspect_ratio) - Generate a video from the given prompt * - :py:obj:`generate_video_stabilityai_async `\ (prompt, aspect_ratio) - Generate a video from the given prompt * - :py:obj:`get_enhanced_prompt_async `\ (subtitleText) - Generates an enhanced prompt from an original one, probably written by a user or * - :py:obj:`get_keywords_from_prompt_async `\ (subtitleText, excluded_words) - Generates keywords from a subtitle text using the Replicate API. * - :py:obj:`get_music_generation_keywords_async `\ (text) - Generate keywords from a text using the Replicate API * - :py:obj:`get_sendable_image `\ (image, aspect_ratio) - \- * - :py:obj:`get_subtitles_async `\ (audiofile_path) - Extract subtitles from an audio file using the Replicate API * - :py:obj:`interpolate_async `\ (video) - Run some interpolation magic. This model may fail after timeout, so you .. rubric:: Members .. py:method:: add_part_gemini(data_to_add, data_kind, valid_data_extensions) .. py:method:: ask_gemini(prompt, gemini_version='gemini-1.5-pro-002', more_contents=None) :async: Prompts Google Gemini model :param prompt: The Prompt to query Gemini on :param gemini_version: the version of gemini we want to use :param more_contents: To get more precise answers, an array of a conversation we want to simulate with gemini after the prompt, in the form :param [{: "role": "model", "parts": [ { "text": "I do not agree" } ] :param }: :param : :param {: "role": "user", "parts": [ { "text": "Ok, what would be another point of view ?" } ] :param }: :param ]: :returns: The link to the generated video .. py:method:: compose_music_from_text_async(prompt_text: str, duration: int) :async: Compose a music for a prompt text :param prompt_text: The text prompt :param duration: The duration of the music :returns: The link to the generated music .. py:method:: convert_image_to_b64(image, target_size=None) .. py:method:: generate_background_music_async(duration: int = 3, prompt: str = None) -> str :async: Here we generate the music to add as background music :param - duration: int - the duration of the music in seconds :param - prompt: str - the prompt to generate the music from :returns: the path to the generated music :rtype: - str .. py:method:: generate_mp3_from_text_async(prompt_text: str, target_file: str) :async: .. py:method:: generate_mp3_from_text_async_elevenlabs(prompt_text: str, target_file: str) :async: Generate an mp3 file from a text prompt. :param - prompt_text: str - the text to generate the mp3 from :param - target_file: str - the path to the target file :returns: - None .. py:method:: generate_seine_transition_async(source_image_path, target_image_path) :async: Generate a transition between two videos :param index: The index of the video :param initial: Whether this is the initial video :returns: The link to the generated video .. py:method:: generate_video_DynamiCrafter_image_async(prompt) :async: Generate a video from the given prompt :param prompt: The prompt to generate the video from :returns: The link to the generated video .. py:method:: generate_video_VideoCrafter2_async(prompt) :async: Generate a video from the given prompt :param prompt: The prompt to generate the video from :returns: The link to the generated video .. py:method:: generate_video_async(prompt, model_provider: str, aspect_ratio=(16, 9)) :async: Generate a video from the given prompt :param prompt: The prompt to generate the video from :param model_provider: The model provider to use :returns: The path to the generated video .. py:method:: generate_video_from_image_and_text_runway(prompt, aspect_ratio=(16, 9)) :async: Generate a video from the given image prompt :param prompt: Image prompt to generate the video from in base64 format :returns: The link to the generated video .. py:method:: generate_video_from_image_stabilityai_async(prompt, aspect_ratio) :async: Generate a video from the given image prompt :param prompt: Prompt containing an image attribe :returns: The link to the generated video .. py:method:: generate_video_haiper_async(prompt, aspect_ratio) :async: Generate a video from the given prompt :param prompt: The prompt to generate the video from :returns: The link to the generated video .. py:method:: generate_video_stabilityai_async(prompt, aspect_ratio) :async: Generate a video from the given prompt :param prompt: The prompt to generate the video from :returns: The link to the generated video .. py:method:: get_enhanced_prompt_async(subtitleText) :async: Generates an enhanced prompt from an original one, probably written by a user or translated from an audio :param A subtitle text: :returns: A prompt enhanced by an LLM .. py:method:: get_keywords_from_prompt_async(subtitleText, excluded_words: str = None) :async: Generates keywords from a subtitle text using the Replicate API. :param A subtitle text: :returns: A list of keywords generated by an LLM using the subtitle text .. py:method:: get_music_generation_keywords_async(text) -> str :async: 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 :param text: The text to generate keywords from :returns: A list of keywords .. py:method:: get_sendable_image(image, aspect_ratio) .. py:method:: get_subtitles_async(audiofile_path) :async: Extract subtitles from an audio file using the Replicate API :param i: The index of the audio slice :type i: int :returns: The subtitles obtained from the Replicate API :rtype: subs .. py:method:: interpolate_async(video) :async: Run some interpolation magic. This model may fail after timeout, so you should call it with retry logic :param video: The video to interpolate :returns: a link to the interpolated video Attributes ---------- .. py:data:: KEYWORDS_FORMAT_PROMPT :value: "' Just list the keywords in english language, separated by a coma, do not re-output the prompt.... .. py:data:: VALID_AUDIO_EXTENSIONS :value: ['.mp3', '.wav', '.aiff', '.aac', '.ogg', '.flac'] .. py:data:: VALID_IMAGE_EXTENSIONS :value: ['.png', '.jpg', '.jpeg', '.bmp', '.tiff', '.webp'] .. py:data:: VALID_VIDEO_EXTENSIONS :value: ['.mp4', '.mov', '.avi', '.wmv', '.webm'] .. py:data:: http_timeout .. py:data:: mistral_version :value: 'meta/meta-llama-3-70b-instruct' .. py:data:: vikit_backend_url