This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json, os, requests, openai | |
openai_api_key = os.getenv('OPENAI_API_KEY') | |
openai.api_key = openai_api_key | |
chunks_dir = "novel/chunks/" | |
edits_dir = "novel/edits/" | |
#helper function to process files in a directory | |
def process_directory(d, func): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# frozen_string_literal: true | |
# Adds a `frozen_string_literal` comment to the top of files created by Rails | |
# generators. | |
# | |
# Originally inspired by: | |
# https://gist.github.com/ta1kt0me/6a7058d16621785d4f7038bde6cd3b98 | |
# Modified version for Rails 6 at: | |
# https://gist.github.com/thornomad/4e2f0905e2a4a6eefbc4be5772dfd4f7 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
""" | |
To use: | |
1. install/set-up the google cloud api and dependencies listed on https://github.com/GoogleCloudPlatform/python-docs-samples/tree/master/texttospeech/cloud-client | |
2. install pandoc and pypandoc, also tqdm | |
3. create and download a service_account.json ("Service account key") from https://console.cloud.google.com/apis/credentials | |
4. run GOOGLE_APPLICATION_CREDENTIALS=service_account.json python make_audiobook.py book_name.epub | |
""" | |
import re | |
import sys |