What I learnt from building an AI app
A few hours ago, I completed a project I had been working on for a while that involved integrating two APIs into a single system. The goal was to create a summarization app capable of processing both user-entered text and file uploads to generate concise summaries.
Okay, let me clarify.
With the power of Large Language Models (LLMs), the text provided by the user is first summarized to make it more concise — keeping in mind there’s a limit on the amount of text that can be submitted. This summarized text is then converted into human-like audio using the ElevenLabs API, all delivered seamlessly within a Streamlit application.
Simple Right?!
Well, as simple as this project might seem, there’s a lot I learned along the way — lessons I’ll be sharing, no matter how small. So, strap in! You might just pick up a thing or two:
The Magic of Configuration Files (YAML)
One of the biggest takeaways from this project was the power of a good configuration file — specifically, YAML in my case. I set up configurations for both the summarization components (like LLM summarization) and the speech synthesis path. This YAML file was a game-changer, giving me the flexibility I needed during development. Whether it was switching out the model, adjusting the voice_id
, or tweaking the endpoint URL, having everything neatly organized in a config file made it super easy to experiment with different setups and find the best fit.
CSS Styling of the Streamlit Application
After wrapping up the main functionality of the project, I decided it would be cool to add some flair to the About page. Initially, it felt a bit too plain, and I wasn’t fully satisfied with the look. So, I figured, why not add some styling? That’s when I discovered a neat trick: while using the markdown
function in Streamlit, there's a parameter that allows you to execute HTML and CSS code. This opened up a whole new world of customization possibilities, letting me fine-tune the page to match the project’s vibe.
Managing Secrets When Deploying to Streamlit Cloud
We all know that the .env
file is the go-to for storing secrets, but when it comes to deploying a Streamlit app linked to your GitHub repo, committing your .env
file is a big no-no. Thankfully, Streamlit offers a clever workaround. When you deploy your app, you can create a secrets.toml
file to securely store your sensitive information. This way, your secrets stay safe, and your code remains clean and compliant.
Extensive Logging
I made sure to embed logging into all the functions, API connections, and even the decorators. This turned out to be a lifesaver when things went south. The logger was configured to not only capture detailed information but also to point directly to the file that triggered the log. This made debugging much easier, allowing me to quickly trace issues back to their source and fix them efficiently.
And that is it!
Wrapping Up
Building the Vocal Summarizer was an exciting journey full of learning experiences, from mastering YAML configurations to styling with CSS and ensuring everything ran smoothly with extensive logging. Each step brought its own challenges, but also rewarding solutions that made the final product more robust and user-friendly.
If you’re curious to see the final result in action, you can check out the application here. Give it a try and see how it can transform text into concise, easy-to-listen-to summaries!
Others:
App_url : https://vocalsummary.streamlit.app/