2. Getting Started - Paillat-dev/FABLE GitHub Wiki
2.1 Prerequisites
To run FABLE, you need to have Python 3.9 or higher installed on your machine. You also need to set up an OpenAI API key for GPT-3, and a Google OAuth Client ID for the YouTube Data API v3.
2.2 Installing Dependencies
The required Python packages for FABLE are listed in the requirements.txt file. These include:
- TTS
- moviepy
- pysrt
- deepl
- openai
- pillow
- python-dotenv
- google-api-python-client
- Bark
You can install these packages in a new virtual environment (venv) to avoid conflicts with other Python projects. To do this, navigate to the FABLE-main folder in your terminal and run the following commands:
python -m venv venv
source venv/bin/activate # On Windows, use `venv\\Scripts\\activate`
pip install -r requirements.txt
This will create a new virtual environment in a folder named venv and install the required packages in this isolated environment.
2.3 Setting Up API Keys
The main.py script requires an OpenAI API key to generate the video scripts. The first time you run the script, it will prompt you to enter the key. This key is then saved in the env.yaml file in the same directory for future use.
Similarly, the uploader.py script requires a Google OAuth Client ID to upload videos to YouTube. The script uses the google_auth_oauthlib.flow module to authenticate your application. The first time you run the script, it will open a new window in your default web browser asking you to log in to your Google account and allow the application to manage your YouTube videos. After successful authentication, your credentials are saved in a credentials.json file in the same directory for future use.
2.4 Setting Up Google OAuth Client ID
To set up a Google OAuth Client ID with YouTube Data API v3 access and the "manage channel" scope, follow these improved steps:
- Go to the Google Cloud Console.
- Create a new project by clicking on the "Select a project" dropdown at the top of the page and choosing "New Project".
- Give your project a name and click "Create".
- In the left-hand menu, navigate to "APIs & Services" > "Credentials".
- Click on the "Create Credentials" button and select "OAuth Client ID" from the dropdown menu.
- Configure the OAuth consent screen. Choose the appropriate User Type based on your usage. If you are the only one using the application, you can select "External".
- Fill in the necessary details such as the Application Name and Authorized Domains.
- Under the "Scopes" section, click on "Add or Remove Scopes".
- In the "Select an API" search box, type "YouTube Data API v3" and select it from the results.
- Add the "manage channel" scope by checking the corresponding box.
- Click on "Update" to save the selected scopes.
- In the "Create OAuth client ID" screen, select "Desktop app" as the Application type. You can leave the name as the default or change it to something more descriptive.
- Click "Create". You'll then see a screen with your Client ID and Client Secret.
- Click the download icon next to the Client ID to download a JSON file containing your Client ID and Client Secret.
- Rename the downloaded file to
client_secret.json. You will be asked to paste it in a directory when needed. Now you're ready to run themain.pyscript and generate your first video.
Note: Make sure to keep your API keys and OAuth client ID secret. Anyone with access to them can use them to act as your application or access your data.