«   Previous tip

AI: How to generate AI Video summaries yourself

Last updated: 20th April 2023

Introduction

AI video summary tools are cropping up all over the place. I take a look at one, and show you the instructions on how to set it up yourself using video-summary-streamer.

Instructions

First, setup the backend:

  1. Clone the repository:
git clone https://github.com/jxnl/video-summary-streamer.git
cd summary_app
  1. Install Python dependencies:
pip3 install -r requirements.txt
  1. Install and start PostgreSQL:
brew install postgresql
brew services start postgresql
  1. Create the database and user:
createdb video_summaries
createuser video_user --pwprompt
psql -d video_summaries -c "GRANT ALL PRIVILEGES ON DATABASE video_summaries TO video_user;"
  1. Initialize the schema:
DB_URL=postgresql://video_user:12345@localhost/video_summaries python3.11 schema.py
  1. Fix the SSL error (if necessary) by removing the SSL requirement when connecting to a database. To this, modify db.py on line #6:
engine = sa.create_engine(url=url)
  1. Start the app:
# Install uvicorn if needed: https://www.uvicorn.org/

# This specifies an environment variable, and runs the app
DB_URL=postgresql://video_user:12345@localhost/video_summaries uvicorn run:app
  1. Set an environment variable with your OpenAI key:
export OPENAI_API_KEY=....
  1. Generate a summary of a YouTube video:
curl --no-buffer -X 'POST'
'http://127.0.0.1:8000/youtube_markdown'\
-H 'accept: application/json'
-H 'Content-Type: application/json'
-H "Authorization: Bearer $OPENAI_API_KEY"
-d '{
"url": "https://www.youtube.com/watch?v=PxP2qLkhQM4"
}'

Now, for the frontend:

  1. Clone the repository:
git clone https://github.com/jxnl/magic-text.git
cd magic-text/magic-text
  1. Install npm dependencies:
npm install
  1. Modify summary.ts line 25:
const res = await fetch("http://127.0.0.1:8000/youtube_markdown", {
  1. Start the development server:
npm run dev
  1. Navigate to the frontend:
http://localhost:3000/youtube

Now you enter a URL in the app, and see the generated summary!

«   Previous tip

Sign up to receive a developer tip, in the form of a gif, in your inbox each week