Disclaimer: this was just for fun and to learn about openai
I started messing around with openai's API and wanted to share some CLI tools. The following was used to test these scripts. May create a small container or codespace for this in the future.
Fedora Silverblue 37 (VM):
- 4 x 2 Vcpus (8 cores total)
Packages Needed:
- ffmpeg (audio/video decoding tool)
- yt-dlp (download youtube vids fast)
- python3, pip, and Whisper (see Openai whisper git repo)
- these packages can be installed with your pkg manager.
$ mkdir dev; cd dev; mkdir Text Audio
$ cat <<EOF > commands.sh
#!/bin/bash
#Get URL from user.
read -p 'Video link: ' YOUTUBE_VIDEO_URL
#Convert given URL to a .mp3.
yt-dlp -x --audio-format mp3 $YOUTUBE_VIDEO_URL \
-o ~/dev/Audio/audio.mp3
# Transcribe .mp3 to English Text.
whisper ~/dev/Audio/audio.mp3 --language English \
--task transcribe --model base -o ~/dev/Text
EOF
Check out whisper repo for more usage examples!
$ cat <<EOF > apiKey.py apiKeyOAI = '$YOUR KEY HERE' EOF
Cleanup .py file with API call to Completion endpoint.
quick notes on some neat things you can do with whisper. Still need to clean this up in future.