-
Create and fill in
.env
using.env.example
as an example. -
Install required gems
bundle install
Install required yarn packages
yarn install
- Turn your PDF into embeddings for GPT-3:
ruby ./lib/scripts/pdf_to_pages_embeddings.rb --pdf /your/path/to/book.pdf
Note
This script uses pdftotext
gem to read pdf files in ruby. In order to use this
gem you need to install Poppler on your machine.
To install Poppler using Homebrew:
brew install poppler
For more information on installing Poppler refer to: https://www.viget.com/articles/extract-embedded-text-from-pdfs-with-poppler-in-ruby/
- Set up database tables and initialize seed data:
rails db:migrate
rails db:seed
To run the rails server over port 3000 for this app open a terminal window and type:
rails s
And to run webpack dev server open another terminal window and run
./bin/webpack-dev-server
- Create a new heroku app
heroku create my-app
- Set heruko as remote repo
git push herku main
- Last step is to setup database
heroku db:migrate
heroku db:seed
Note that you would need to create your embeddings and place them in ./lib/assets/book.pdf
Happy hacking