YouTube Summary with Whisper API, ChatGPT API + Eleven Labs Voice
- To let users consume content in the forms they want, not necessarily the forms they are uploaded in
- To reclaim time spent watching long form content when not necessary, summarisation helps understand whether longer content is worth your time
- Proof of concept for a larger suite of personalised content summarisation tools
- Learning more about user cases for AI & the ease of developing helpful micro tools with ChatGPT
I'm building a platform for devs to share their projects - come join!
Note: the Eleven Labs Voice Summary is optional ( Can be removed or #commented out )
- You can choose from different OpenAI models in models.py - GPT3.5-turbo is default
- The current prompts are just experiments and you are encouraged to try variations to find something that works for you
- systembot.txt will set a system message for the gpt functions - leaving this blank has worked well so far
- Open colab file from colab - you likely need to create a new notebook and upload to your drive
- Browse to colab hosted resources from the folder icon on the left pane
- Upload all necessary local files (can copy contents of the 'copy-my-contents' folder)
- Set your keys in the openai and elevenlabs txt files - note this is not safe to share, feel free to secure colab api keys in other ways
- Set intended Youtube URL in "URL.txt"
- Run colab sections
- Copy .env.template & rename to .env
- Set Your OpenAI Key and in .env
- (optional) Set Your Eleven Labs API in .env - for voiced transcripts
- Set the desired YouTube URL in "URL.txt"
- Edit local path folders in podsummariser.py as needed
- May need to
pip -r requirements.txt
- Run
python podsummariser.py
Note: All summarised files are placed in a './summary/' subfolder
- Downloads high quality version of youtube video via pytube
- Extracts audio into segment files via pydub so it can be transcribed to text via Whisper API
- Uses Whisper API to transcribe segments
- Joins segments back up - full transcription can be found in 'podscript.txt'
- 'podscript.txt' fed to GPT in chunks with the task in 'prompt1.txt' to make a full summary, summarised to 'initialsummary.txt'
- 'initialsummary.txt' is broken into chunks and put through GPT with the task 'prompt2.txt' to make bulletpoints and 'prompt23txt' to make a concise summary, summaries saved in 'bulletpoints.txt' and 'shortsummary.txt'
- 'bulletpoints.txt' fed into gpt to generate a narration synopsis - 'synopsis.txt'
- 'synopsis.txt' is sent to elevenlabs API to be transcribed to an audio spoken file - audiosynopsis.mp3
- If you run into errors with ffmpeg - run
brew install ffmpeg
Credit for initial codebase that has been a key building block for further development goes to allaboutai on Youtube
User assumes all responsibility in using the tool in ways that comply with their local and federal laws.