Teller of Tales is a project that creates narrated video stories from book chapters using natural language processing (NLP), OpenAI, Ollama and StableDiffusion. It can run multiple projects at once and generate videos automatically and unsupervised. The results may vary depending on the input text and the chosen options.
- NLP with OpenAI, Ollama or KeyBERT
- Image generation with StableDiffusion
- Text to speech with Edge Text-to-Speech or Elevenlabs
- Video editing with MoviePy
Here is an example of a video story created by Teller of Tales: https://www.youtube.com/watch?v=-wGfmEuONqo
- User places a chapter of a book into the ‘story.txt’ file in the ‘projects/my_project_name’ directory.
- User starts the program with the ‘python .\teller_of_tales.py’ command.
- User goes away to do something else.
- Text in the chapter is split into separate sentences.
- Sentences are combined into fragments of appropriate length.
- Each text fragment is converted to an audio file using text to speech.
- Prompts for StableDiffusion are created using ChatGPT or KeyBERT. Prompts describe the situation that 'can be seen' in a given text fragment.
- Using StableDiffusion and prompts from point 7, image is created.
- Audio and image files are transformed into a video file of the current scene using MoviePy.
- Video files of separate scenes are concatenated into the final video file.
- User comes back and watches the final video file.
- Python 3.8.10
- NVidia GPU with 4GB VRAM.
- Create new virtual env:
python -m venv env
- Activate your virtual env:
env/Scripts/activate
- Install PyTorch from https://pytorch.org/get-started/locally/:
pip3 install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu116
- Install packages from included requirements.txt:
pip install -r .\requirements.txt
- Install ImageMagick:
https://imagemagick.org/script/download.php
Add both check boxes:
* Associate supported file extensions
* Install legacy utilities
- Add your OpenAI Token from https://beta.openai.com/account/api-keys to environment variables:
setx OPENAI_TOKEN=your_token
6a. Don't want to use OpenAI account? No problem! Make sure that USE_CHATGPT in config.ini is set to no:
USE_CHATGPT = no
- Login to HugginFace using your Access Token from https://huggingface.co/settings/tokens:
huggingface-cli login
- Create a folder in the ‘projects’ directory. The folder name will become the final video name.
- Paste your story into the story.txt file inside the created folder.
- Create multiple folders and paste multiple stories if you want to run multiple projects at once.
- Run the python script:
python .\teller_of_tales.py
- Wait for the script to finish and check the folder with project for the output video.