
After finishing a big project, do you ever feel like treating yourself to some well-earned downtime? Just a period to relax and do as little as possible?
That’s exactly how I felt after wrapping up my first GenAI project.
From creating the MVP to setting up email and website hosting, designing the landing page, handling signups and subscriptions, and even splitting the MVP into a website and a standalone macOS app — it was a whirlwind. I needed a smaller project to reset and recharge.
If you’re curious about the rollercoaster of challenges I faced during this process, I’ve shared all the gritty details in this article:
But let’s be real: sometimes, you just feel lazy.
Those days when everything feels like a struggle, and even typing a few words seems too much. Other times, you’re feeling a little down and need a boost — something to lift your spirits and keep you going.
That’s when ChatGPT usually steps in as my go-to buddy.
But then I thought, what if I’m too lazy to type full sentences? What if I just want to type one word — or better yet, nothing at all — and still get a little spark of inspiration?
And so, the idea for Project 2 in my GenAI challenge was born: a Daily Inspirational Quotes Generator! A simple app designed to deliver instant motivation with minimal effort.
Project Goals
For this project, I wanted to create a web app that:
Displays an inspirational quote as soon as the page loads.
Allows users to type a keyword (e.g., “happiness,” “success,” or “friendship”) to generate a quote tailored to their input.
Offers a “Generate” button that refreshes the quote for more variety.
Responds to more specific phrases (e.g., “overcoming failure”) for personalized inspiration.
Ultimately, the app should be quick, simple, and uplifting — a tool to brighten someone’s day with just a click (or no click at all!).
Choice of Model and Frameworks
For this project, I decided to use GPT-2 via the Hugging Face Transformers library. GPT-2 is admittedly older than some newer models, but it is still a robust language model capable of generating meaningful and coherent text. It’s also lightweight and perfect for this small-scale project. Hugging Face made integration easy with its well-documented API and pre-trained models.
The decision of GPT-2 comes after using an entire article exploring the AI text LLM models and frameworks.
On the framework side:
I chose Flask for the backend because of its simplicity and versatility.
The frontend was built using plain HTML, CSS, and JavaScript, keeping it lightweight and functional.
For inspiration data, I used a mix of pre-written inspirational quotes stored locally as a fallback and dynamically generated text from GPT-2 for more personalized responses.
Help from Cursor (My New Best Friend)
Once again, Cursor came through for me! After describing my project idea and goals, it:
Generated the initial folder structure for the app, including separate files for HTML templates, CSS styling, and JavaScript functionality.
Wrote the Flask backend, integrating GPT-2 through Hugging Face Transformers for generating quotes.
Designed a clean and simple HTML template for the app, with a text input box for keywords and a “Generate” button.
Handled the JavaScript to send requests to the backend and update the displayed quote dynamically.
Cursor’s guidance made it incredibly easy to connect the frontend with the backend and set up GPT-2 for generating text. It even suggested fallback mechanisms for when the model output wasn’t ideal.
Outcome
Here’s what the app can do:
Initial Page Load
As soon as the app opens, it displays an inspirational quote like:
Keyword Input
Type a keyword like “happiness,” and it generates a related quote. For example:
Click “Generate” again to refresh the quote with a new one on the same topic. It feels like flipping through an endless book of wisdom.
More Specific Input
Type in a more detailed phrase, like “happiness with a cat” and the app tailors the quote to your query. Example:
Problems and Improvements
Of course, no project is without its quirks. Here are a few challenges I ran into:
1. Sentence Splitting Issues
At times, GPT-2 didn’t structure sentences well. For instance, when generating a longer quote, the model occasionally produced run-on sentences or abrupt cutoffs. To address this, I added some post-processing logic to clean up the output, but it’s still not perfect.
2. Keyword Sensitivity
The model sometimes struggled with highly specific keywords. For instance, typing “adventure” occasionally returned quotes unrelated to the topic. A potential fix would be to filter generated text through a curated list of fallback quotes if the match score is too low.
3. UI Tweaks
The UI, while functional, could use a bit more attractive. Adding animations or using a CSS framework like TailwindCSS could make it more visually appealing. Right now, it’s very minimalistic, but for a quick prototype, it does the job.
4. Model Limitations
GPT-2 occasionally repeated itself or generated slightly off-topic responses. While this is fine for small-scale projects, using a larger model like GPT-3.5 or a fine-tuned GPT-2 could improve coherence and relevance.
Final Thoughts
This project turned out to be surprisingly fun and satisfying! I now have a little app that can brighten my day with just a word or click. It’s amazing how small things, like a well-timed quote, can have a big impact on your mood or motivation.
I also learned a lot about handling dynamic user input and working with GPT-2 for real-world applications. Cursor made the coding process much easier, guiding me through integrating Hugging Face and Flask seamlessly.
Next up on my 30-Project challenge is tackling the hiccups I discovered during this experiment. Stay tuned for what’s coming next, and if you have suggestions for how to improve my quotes generator, I’d love to hear them!
Until next time, let’s keep inspiring each other! ✨
This is awesome! This reminds of back when I was an intern, I would send out daily team email updates and the email template started with a daily inspirational quote. I spent so much time looking for quotes everyday, this tool would've been great!
Way to go!