-
Notifications
You must be signed in to change notification settings - Fork 2
Generative AI Book English with soundtrack
Robotoons edited this page Jun 3, 2024
·
3 revisions
This Python script is designed for an experiment where turning the pages of the BookLed physical book triggers the playback of an MP3 audio, generated in real-time by AI. The AI analyzes the graphical content of the book pages and produces a corresponding story. Each page turn prompts the AI to generate a unique narrative, which is then converted to speech using OpenAI's TTS API. Additionally, a contextual soundtrack is played alongside the narration.
This wiki page provides step-by-step instructions for setting up and running the "AI Book English with soundtrack" jupyter notebook code from this GitHub repository.
- BookLed Device: Connect the BookLed to the PC via USB and ensure the correct COM port is configured.
- OpenAI API: An active OpenAI API account is required.
- Internet Connection: The OpenAI API and GitHub content are accessed via the internet.
- FFmpeg: Ensure FFmpeg is installed and configured correctly for audio processing.
- Open the GitHub repository link: GitHub Link
- Click on the
Rawbutton to view the raw file. - Right-click on the page and select
Save as...to download the file to your local machine.
- Open your terminal (or Git Bash if on Windows).
- Navigate to the directory where you want to clone the repository:
cd /path/to/your/directory - Clone the repository:
git clone https://github.com/robotoons/BookLed.git
- Navigate to the specific directory containing the Jupyter notebook:
cd BookLed/codes/jupyter notebooks
- Open your terminal.
- Navigate to the directory containing the Jupyter notebook if you haven't already:
cd /path/to/BookLed/codes/jupyter notebooks - Create a virtual environment (optional but recommended):
python -m venv myenv
- Activate the virtual environment:
- On Windows:
myenv\Scripts\activate
- On macOS/Linux:
source myenv/bin/activate
- On Windows:
- Install the required dependencies:
Manually install the necessary packages:
pip install pydub serial requests python-dotenv openai pyaudio
- Ensure your virtual environment is activated.
- Launch Jupyter Notebook:
jupyter notebook
- In the Jupyter Notebook interface, navigate to the directory containing your downloaded notebook file (
BookLed Experiment 5 (AI book) - ENGLISH V5.ipynb) and open it.
- Connect the BookLed to your PC via USB.
- Configure the correct COM port number.
- Ensure you have an active internet connection.
- Ensure you have an active OpenAI API account.
- Power on the BookLed device.
For complete Puthon and ffmpeg setup for windows 10, go to the wiki page Python Environment Setup.