YouTubeScript GPT: Streamline Your YouTube Script Creation Process (with code)

Creating compelling video scripts made easy with AI

grvt 🐼
3 min readMay 25, 2023

Are you a content creator struggling to come up with engaging and informative scripts for your YouTube videos? Introducing YouTubeScript GPT, an AI-powered application designed to assist you in generating high-quality video scripts effortlessly. This innovative tool combines the power of OpenAI GPT-3.5 language model, Langchain’s text summarization and topic extraction capabilities, and the user-friendly interface provided by Streamlit. With YouTubeScript GPT, you can create compelling content that keeps your viewers hooked!

Simplifying the Script Creation Process

YouTubeScript GPT leverages the advanced language generation capabilities of OpenAI GPT-3.5 to provide script suggestions tailored to your specific needs. Whether you’re creating educational tutorials, entertaining vlogs, or informative product reviews, this application can help you craft scripts that resonate with your target audience.

Harnessing the Power of Langchain and Wikipedia

To enhance the accuracy and relevance of the generated scripts, YouTubeScript GPT integrates Langchain, a powerful text summarization and topic extraction tool. By analyzing relevant Wikipedia articles, Langchain extracts key information and summarizes it concisely. This ensures that the scripts generated by YouTubeScript GPT are well-informed and cover essential aspects of your chosen topic.

User-Friendly Interface with Streamlit

YouTubeScript GPT is built using Streamlit, a user-friendly Python library for creating interactive web applications. With its intuitive interface, you can easily navigate through the application, generate script suggestions, and fine-tune them according to your requirements. Streamlit provides a seamless experience, allowing you to focus on your content creation process.

Getting Started with YouTubeScript GPT

To get started with YouTubeScript GPT, you need to follow a few simple steps. First, ensure that you have Python 3.10 or higher installed on your system. Then, clone the GitHub repository for YouTubeScript GPT and navigate to the project directory. Install the required packages listed in the requirements.txt file using the pip package manager. Additionally, you’ll need to obtain an API key from OpenAI, which can be done by visiting the OpenAI website.

Once you have everything set up, open the mainapp.py file and run the application using the Streamlit command. This will launch the YouTubeScript GPT interface in your browser. Simply follow the on-screen instructions to start generating video scripts tailored to your needs.

Here the full code or you can visit the github repo

# Bring in deps
import os
import requests
import streamlit as st
from langchain.llms import OpenAI
from langchain.prompts import PromptTemplate
from langchain.chains import LLMChain, SequentialChain
from langchain.memory import ConversationBufferMemory
from langchain.utilities import WikipediaAPIWrapper


st.title('📝 YoutubeScript GPT')


apikey = st.text_input('Enter your API key here' , type='password')
st.markdown('_[To grab your apikey](https://platform.openai.com/account/api-keys) or check OpenAI website_')


if apikey:

session = requests.Session()
session.headers['Authorization'] = 'Bearer {}'.format(apikey)

response = session.get('https://api.openai.com/v1/engines')

if response.status_code == 200:
print('Success!')

os.environ['OPENAI_API_KEY'] = apikey
prompt = st.text_input('Plug in your prompt here')

# Prompt templates
title_template = PromptTemplate(
input_variables = ['topic'],
template='write me a youtube video title about {topic}'
)

script_template = PromptTemplate(
input_variables = ['title', 'wikipedia_research'],
template='write me a youtube video script based in on this title TITLE: {title} while leveraging this wikipedia reserch:{wikipedia_research} '
)

# Memory
title_memory = ConversationBufferMemory(input_key='topic', memory_key='chat_history')
script_memory = ConversationBufferMemory(input_key='title', memory_key='chat_history')


# Llms
llm = OpenAI(temperature=0.9, max_tokens=1000)
title_chain = LLMChain(llm=llm, prompt=title_template, verbose=True, output_key='title', memory=title_memory)
script_chain = LLMChain(llm=llm, prompt=script_template, verbose=True, output_key='script', memory=script_memory)

wiki = WikipediaAPIWrapper()

# Show stuff to the screen if there's a prompt
if prompt:
title = title_chain.run(prompt)
wiki_research = wiki.run(prompt)
script = script_chain.run(title=title, wikipedia_research=wiki_research)

st.write(title)
st.write(script)

with st.expander('Title History'):
st.info(title_memory.buffer)

with st.expander('Script History'):
st.info(script_memory.buffer)

with st.expander('Wikipedia Research'):
st.info(wiki_research)

else:
st.write('Please enter a valid API key')
print('Failure!')

Disclaimer and Acknowledgments

While YouTubeScript GPT aims to streamline the script creation process, it is important to note that the generated content should be reviewed and edited by content creators. The tool provides suggestions and guidance, but it is ultimately the responsibility of the user to ensure accuracy, credibility, and adherence to relevant guidelines or policies.

YouTubeScript GPT relies on external APIs and data sources, such as OpenAI API and Wikipedia. Changes in these APIs or data sources may affect the functionality of the application.

--

--

grvt 🐼
grvt 🐼

Written by grvt 🐼

artist. minimalist. developer.

No responses yet