The ‘video-ai-by-invideo’ plugin is a powerful tool that empowers developers to generate videos programmatically, leveraging InVideo’s artificial intelligence capabilities. This plugin facilitates the automation of various video creation tasks, including the addition of text, images, and transitions, eliminating the need for manual editing. This forum is dedicated to discussing the programmatic approaches to utilizing the ‘video-ai-by-invideo’ plugin.
2 Likes
I am trying to generate a video from a python script using the video-ai-by-invideo plugin. I want to make use of Langchain for this. My code so far looks as follows:
from langchain.chat_models import ChatOpenAI from langchain.agents import load_tools, initialize_agent from langchain.agents import AgentType from langchain.tools import AIPluginTool tool = AIPluginTool.from_plugin_url("https://video-ai.invideo.io/.well-known/ai-plugin.json") llm = ChatOpenAI(temperature=0.15) tools = load_tools(["requests_all"]) tools += [tool] agent_chain = initialize_agent( tools, llm, agent=AgentType.ZERO_SHOT_REACT_DESCRIPTION, verbose=True ) import json # Define your video brief video_brief = { "brief": "Create a video exploring the evolution of smartphones, from the first devices with basic functionalities to the latest models featuring cutting-edge technology. Highlight the impact of smartphones on society.", "settings": "Professional tone, background music that is futuristic.", "title": "The Evolution of Smartphones", "description": "A journey through the history of smartphones, showcasing how they've transformed from simple communication devices to essential tools for our daily lives.", "platforms": ["YouTube", "LinkedIn"], "audiences": ["tech enthusiasts"], "length_in_minutes": 2 } video_brief_json = json.dumps(video_brief) print("video brief JSON:", video_brief_json) agent_chain(video_brief_json)
looking good so far, I have outputs as follows:
video brief JSON: {"brief": "Create a video exploring the evolution of smartphones, from the first devices with basic functionalities to the latest models featuring cutting-edge technology. Highlight the impact of smartphones on society.", "settings": "Professional tone, background music that is futuristic.", "title": "The Evolution of Smartphones", "description": "A journey through the history of smartphones, showcasing how they've transformed from simple communication devices to essential tools for our daily lives.", "platforms": ["YouTube", "LinkedIn"], "audiences": ["tech enthusiasts"], "length_in_minutes": 2} > Entering new AgentExecutor chain... I need to create a video exploring the evolution of smartphones. I should use the Video AI by invideo API to transform the text into a stunning video. Action: invideoAI Action Input: None Observation: Usage Guide: Invideo AI provides a plugin for crafting narrated videos from text prompts and scripts. invideo AI transforms textual prompts into video timelines, complete with voiceover, stock images, and footage. It excels in generating videos across a range of genres including educational content, advertisements, and fiction. To effectively use the invideo AI plugin: * The user just needs to ask the plugin to create a video. * The user must provide as much of their own personality, creativity and opinions as possible. The more opinionated and unique the request, the better the video will be. * The user should choose a topic that they are passionate about. Capabilities: * Videos can be created from a brief or a script. * Supports male and female voices in over 100 accents, ranging from American and Midwestern to British, Indian, and Australian. * Videos can be 0.25 mins to 30 mins long. * The plugin is particularly effective for crafting TikToks, Reels, YouTube Shorts, and explainer videos. Output: * The output will be a link to the generated video, title and description. OpenAPI Spec: {'openapi': '3.0.1', 'info': {'title': 'invideo AI', 'description': 'Plugin for crafting narrated videos from text prompts and scripts.', 'version': 'v1'}, 'servers': [{'url': 'https://pro-api.invideo.io'}], 'paths': {'/api/copilot/request/chatgpt-new-from-brief': {'post': {'operationId': 'generateVideoFromBrief', 'summary': 'Generate video from a detailed brief.', 'requestBody': {'required': True, 'content': {'application/json': {'schema': {'$ref': '#/components/schemas/VideoFromBriefInput'}}}}, 'responses': {'200': {'description': 'OK', 'content': {'application/json': {'schema': {'$ref': '#/components/schemas/VideoResponse'}}}}}}}, '/api/copilot/request/chatgpt-new-from-script': {'post': {'operationId': 'generateVideoFromScript', 'summary': 'Generate video from a script.', 'requestBody': {'required': True, 'content': {'application/json': {'schema': {'$ref': '#/components/schemas/VideoFromScriptInput'}}}}, 'responses': {'200': {'description': 'OK', 'content': {'application/json': {'schema': {'$ref': '#/components/schemas/VideoResponse'}}}}}}}}, 'components': {'schemas': {'VideoFromBriefInput': {'type': 'object', 'properties': {'brief': {'type': 'string', 'description': 'Plain english text starting with "Create a video" or "Create a [platform] video"'}, 'settings': {'type': 'string', 'description': 'Plain english text covering instructions such as gender and accent of the voiceover, tone of the background music. Can be left empty.'}, 'title': {'type': 'string'}, 'description': {'type': 'string'}, 'platforms': {'type': 'array', 'items': {'type': 'string'}, 'description': 'suggest three platforms this video would be ideal for'}, 'audiences': {'type': 'array', 'items': {'type': 'string'}, 'description': 'suggest three audiences this video would be ideal for'}, 'length_in_minutes': {'type': 'float', 'description': 'suggest the length of the video in minutes'}}, 'required': ['title', 'description', 'platforms', 'audiences', 'length_in_minutes', 'brief', 'settings']}, 'VideoFromScriptInput': {'type': 'object', 'properties': {'script': {'type': 'string', 'description': 'plain english text that is the script of the video'}, 'settings': {'type': 'string', 'description': 'Plain english text covering instructions such as gender and accent of the voiceover, tone of the background music. Can be left empty.'}, 'title': {'type': 'string'}, 'description': {'type': 'string'}, 'platforms': {'type': 'array', 'items': {'type': 'string'}, 'description': 'suggest three platforms this video would be ideal for'}, 'audiences': {'type': 'array', 'items': {'type': 'string'}, 'description': 'suggest three audiences this video would be ideal for'}, 'length_in_minutes': {'type': 'float', 'description': 'suggest the length of the video in minutes'}}, 'required': ['title', 'description', 'platforms', 'audiences', 'length_in_minutes', 'script', 'settings']}, 'VideoResponse': {'type': 'object', 'properties': {'video_url': {'type': 'string'}}}}}} Thought:I have the OpenAPI spec for the Video AI by invideo API. I can use the "generateVideoFromBrief" operation to create a video from the provided brief. Action: requests_post Action Input: { "url": "https://pro-api.invideo.io/api/copilot/request/chatgpt-new-from-brief", "data": { "brief": "Create a video exploring the evolution of smartphones, from the first devices with basic functionalities to the latest models featuring cutting-edge technology. Highlight the impact of smartphones on society.", "settings": "Professional tone, background music that is futuristic.", "title": "The Evolution of Smartphones", "description": "A journey through the history of smartphones, showcasing how they've transformed from simple communication devices to essential tools for our daily lives.", "platforms": ["YouTube", "LinkedIn"], "audiences": ["tech enthusiasts"], "length_in_minutes": 2 } } Observation: {"thumbnail_url":"https://pro-st.invideo.io/thumbnail/composite_youtube?bucket=iv-prod-pro-stocks®ion=us-west-2&key=generated_thumbnails_for_chatgpt/391448e48e0e7a60e0f9b9aa58ba16ef271e87d0528864ff950aa9e80475ce14/391448e48e0e7a60e0f9b9aa58ba16ef271e87d0528864ff950aa9e80475ce14","video_url":"https://ai.invideo.io/ai-video?video=the-evolution-of-smartphones-qdfzmh"} Thought:--------------------------------------------------------------------------- OutputParserException Traceback (most recent call last) Details of the error ... OutputParserException: Could not parse LLM output: `I have successfully generated a video from the provided brief using the Video AI by invideo API. The video can be accessed using the provided video URL: "https://ai.invideo.io/ai-video?video=the-evolution-of-smartphones-qdfzmh".`
But this approach is producing an error at the end. How do I avoid this error message?
1 Like
this is great!!!, this will unveil more opportuniteis for global issues with sign language users with lack of literacy! to comprehends the complex, wordy documents, statements or email!!