• Stars
    star
    498
  • Rank 88,494 (Top 2 %)
  • Language
    Python
  • Created about 2 years ago
  • Updated about 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Setup

  1. Create and fill in .env using .env.example as an example.

  2. Install required Python packages

pip install -r requirements.txt

Mac M1 / OS X Note: if you get an error installing psycopg2, you may need:

brew install postgresql

See psycopg/psycopg2#1200

  1. Turn your PDF into embeddings for GPT-3:
python scripts/pdf_to_pages_embeddings.py --pdf book.pdf
  1. Set up database tables and collect static files:
python manage.py makemigrations
python manage.py migrate
python manage.py collectstatic
  1. Other things to update:
  • Book title
  • Book cover image
  • URL to purchase book
  • Author name and bio

Deploy to Heroku

  1. Create a Heroku app:
heroku create askmybook

Set config variables on Heroku to match your .env.

  1. Push to Heroku:
git push heroku main
heroku ps:scale web=1
heroku run python manage.py migrate
heroku open
heroku domains:add askmybook.com

Run locally

source venv/source/activate
pip install -r requirements.txt
heroku local

Note: macOS Monterey uses port 5000 (the default port) for AirPlay sharing, so you will need to run heroku local on a different port. For example:

heroku local -p 5001

Deploying

Deploy to Heroku with:

git push heroku main --no-verify

no-verify is added due to using Git LFS for the large embedding file.