Skip to content
site logo mobile

Code Snippets Library >

YouTube Video -> Blog Outline Using SimplerLLM

🔑 ID:

32761

👨‍💻

Python

🕒

07/03/2024
Free

Description:

SimplerLLM is a Python Library I developed recently, it made coding much easier and saved me a lot of time.

This code usually takes multiple functions and a lot more coding than that, however using SimplerLLM it became so simple to do so.

However, make sure you create a “.env” file in the same folder as the code which contains your OpenAI API key and Gemini API key. (you can leave the Gemini key blank if you plan only on using OpenAI and vice versa)

Code:

from SimplerLLM.tools.serp import search_with_duck_duck_go
from SimplerLLM.tools.generic_loader import load_content
from SimplerLLM.langauge.llm import LLM, LLMProvider

Youtube_url = "Video_URL"

llm_instance = LLM.create(provider=LLMProvider.OPENAI)

video_transcript = load_content(str(Youtube_url))

prompt_1 = f"""You are an expert in Summarization. Your task is to turn 
a youtube video transcript I'm gonna give you into a bullet point summary.
YouTube Video Transcript : {video_transcript}
"""

bullet_points = llm_instance.generate_response(prompt_1)

print(bullet_points)

prompt_2 = f"Your are an expert in Copywriting and SEO. Your task is to turn
a bullet point summary generated from a YouTube video transcrpt into a blog post outline.
Make sure the outline is composed of an introduction, 3 body paragraphs, and a conclusion.
Bullet Point Summary: {bullet_points}"

blog_outline = llm_instance.generate_response(prompt_2)

print(blog_outline)

 

Untitled design (82)

GitHub Link

✖️ Not Available

Untitled design (83)

Download File

✖️ Not Available

If you’re encountering any problems or need further assistance with this code, we’re here to help! Join our community on the forum or Discord for support, tips, and discussion.