AI: How to generate AI Video summaries yourself
Last updated: 20th April 2023Introduction
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:
- Clone the repository:
git clone https://github.com/jxnl/video-summary-streamer.git
cd summary_app
- Install Python dependencies:
pip3 install -r requirements.txt
- Install and start PostgreSQL:
brew install postgresql
brew services start postgresql
- 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;"
- Initialize the schema:
DB_URL=postgresql://video_user:12345@localhost/video_summaries python3.11 schema.py
- 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)
- 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
- Set an environment variable with your OpenAI key:
export OPENAI_API_KEY=....
- 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:
- Clone the repository:
git clone https://github.com/jxnl/magic-text.git
cd magic-text/magic-text
- Install npm dependencies:
npm install
- Modify
summary.ts
line 25:
const res = await fetch("http://127.0.0.1:8000/youtube_markdown", {
- Start the development server:
npm run dev
- Navigate to the frontend:
http://localhost:3000/youtube
Now you enter a URL in the app, and see the generated summary!