Overview of My Submission
This tutorial will teach you how to create blog posts automatically from videos. If you are a content creator, you may find this very useful to speed up the process of writing new posts using just your own video tutorials.
Submission Category:
Analytics Ambassadors
Link to Code on GitHub
Automatic Blog Post
Automatic blog post is a Python project created to generate automatically blog posts from videos.
The final blog post consists of 5 main components: title, summary, image, text and keywords. The image above represents how this architecture works. As you can see, this is a machine learning project with natural language processing.
First, we need to process the video to extract the audio. Using the DeepGram API we can do the speech to text. Later, we split the text into paragraphs. For that, we are analyzing the pause between the words to find if the sentences belong to the same paragraph or if it’s a new one.
Then, we use some pre-trained machine learning models to create the text keywords and summary. We also get the video thumbnail and name, which will be our blog post image and title, respectively.
How can I use it?
The…
Additional Resources / Info
My Deepgram Use-Case
The final blog post consists of 5 main components: title, summary, image, text and keywords. The image above represents how this architecture works. As you can see, this is a machine learning project with natural language processing.
First, we need to process the video to extract the audio. Using the DeepGram API we can do the speech to text. Later, we split the text into paragraphs. For that, we are analyzing the pause between the words to find if the sentences belong to the same paragraph or if it’s a new one.
Then, we use some pre-trained machine learning models to create the text keywords and summary. We also get the video thumbnail and name, which will be our blog post image and title, respectively.
Getting Started
The first step to run the project is to create a DeepGram account. After that, you can generate an API key. On this page, just click on the button Create a New API Key. You'll have to choose a name for the key, set permission and set the expiration date.
After you click Create Key button, a new key will be created and it's important that you keep it safe.
To run the code, you’ll need Python installed. My suggestion is to use Anaconda, which is an open-source Python distribution platform.
I also recommend that you create a new environment specifically for this project. Check the official tutorial to learn how to download Conda and set up a virtual environment: Conda Getting Started
To install the Python packages, just clone the project and run the following command:
pip install -r requirements.txt
Then, simply run the command:
python generate_blog_post.py --deepgram <api_key> --video <youtube_url>
Note: This is a demonstration tutorial, if you plan to use this in production, I recommend that you use a Key Vault to store the DeepGram API Key.
After a couple of minutes, you'll see the blog post markdown file in your output directory!
Dive into Details
The code:
- Downloads the audio from the specified video URL
- Downloads the image from the thumbnail
- Crops the black border of the image
- Saves the processed image
- Generates the text from the audio using DeepGram API
- Process the text to fix the punctuation
- Splits the text into new paragraphs using the median pause between words and the punctuation as a heuristic
- Stores the text
- Gets keywords from the text using KeyBERT
- Gets summary using pretrained Hugging Face DistilBART
- Creates a markdown template
- Fill the markdown template with title, image, summary, keywords and text
- Saves the markdown in the output directory
Post-processing
If you need some text post-processing, you can use the edit_blog_post module. This can be useful if your video has some domain-specific words. For example, the abbreviation "ASR" (automatic speech recognition) was captured as "As r". So, in the process_dictionary.json file which you will need to put your key-value pair "As r": "ASR".
The process_dictionary.json looks like this:
{
"As r": "ASR",
"Ai": "AI",
"Apis": "APIs"
}
Then, you can use the following command to automatically replace those words. Don't worry, because it will reuse the previous processing. So, it will not download the audio or try to transcript it again.
python edit_blog_post.py --video <youtube_url>
Well, now your post is ready and saved in the same path!
Conclusion
Now that everything is settled. Let’s test it. For demonstration purposes, we will be using the DeepGram video tutorial on Youtube.
The final blog post:
What is Deepgram?
#aispeechplatform #voicedata #accuraterealtimetranscription
Most automatic speech recognition services or ASR are built on technology that's over fifty years old . The old tech is fine for short call and response audio, but it just doesn't work for conversational audio . We built an end to end deep learning neural network that delivers actually usable transcriptions that get even better over time at lightning speed .
Voice enabled experiences are a big deal in business these days. For a good experience, you need a foundation of real time accurate transcription. But most automatic speech recognition services or ASR are built on technology that's over fifty years old.
Yep, even these guys. The old tech is fine for short call and response audio. Alexa, what's the weather today? But it just doesn't work for conversational audio. I'm having a problem with my super user service. This is what's happening. In order to make real use out of voice data, transcription needs to be accurate, fast, cost effective, scalable. With the old tech, you can maybe get one or two of these requirements. But no matter how hard they try, they just can't adapt it to give you all four. So we reinvented it. Hi, we're Deepgram. We built an end to end deep learning neural network. A what? Sorry, an AI speech platform that delivers actually usable transcriptions that get even better over time at lightning speed. Without how hardware costs or high transcription costs. And because we're better faster and cheaper, guess what. We're also more scalable.
So if you've avoided building that great voice feature because you lack the right APIs. Good news, it's time to get to work. Triple espresso, please, what could you do with accurate real time transcription? Oh, just off the top of our heads, You could create conversational ai. Virtual assistance voice analytics agent enable, compliance improvement better customer experience. Just to name a few. We're here to help you go big. If you don't know where to start, don't worry. In addition to providing the best technology stack, Deepgram makes an excellent partner. We know the world is constantly changing. And your audio and transcription needs will two. Will be with you every step of the way from labeling your data to training custom AI models to deployment on prem or in the cloud. To ensure your transcription foundation is powering the experience that actually delight your customers.
So if you're ready to stop chugging along on less than ideal solutions and start building the great voice product, we're ready to help make it happen Deepgram.
Thank you for reading this. Feel free to leave a comment. I hope it was helpful. Let's share some knowledge! See you in the next post! :)
Top comments (17)
Well presented, I like the tool!
Thanks, Thomas! 😄
This is great! Very thoughtful!
Thanks, Sewvandi! 😁
Wooww
😁
Amazing! A useful tool for generating post from video. Thanks for sharing.
Thanks, Timothy! 😀
Wow
😁
Will this work for languages other than English
Hi, Pritam. Not yet, but I intend to make a v2 can be used in other languages 🙂
This is awesome. Nice work
Thanks, Karthikeyan! 😃
This is super cool project! I was working on the same thing to add it as a new feature in one of my projects too. Great work here and good luck :)
Thanks, Mostafa! 🚀
Hey Karina! I loved your project, and I think it would be really cool if you added it to our new Community Forum. If you want to showcase your project there, you can add it to our built with Deepgram discussion. Also, if you're interested in working on a v2, you should consider adding opting into Hacktoberfest with your project. If you need any help or support, we're here to help.