How to Use AI to Give Yourself A Boost — In More Ways Than One

Vin Bhalerao
7 min readJan 10, 2023

--

ChatGPT home page

As I mentioned in my last post, I had focused most of my writing in 2022 on big picture issues in science and technology, particularly in AI.

For 2023, I am going to experiment with more practical, down to earth issues, hopefully things that people might find useful right away.

In that vein, I am describing below my experiments with OpenAI’s API, both as a software developer as well as a user living in gloomy Seattle in winter! 😓

The Start of a New Year is the Time to Think of Affirmations!

One of the aspects of OpenAI’s services (like GPT-3 / ChatGPT and even more so with DALL-E) that I find particularly interesting is its creative ability.

(I have written about this aspect of AI earlier in “How Did AI Become Creative?” Also, if you aren’t familiar with ChatGPT, here is my post on it.)

And the backdrop of the new year, with everyone thinking about resolutions and positive thinking and so on, provided exactly the inspiration I needed!

I decided to use OpenAI’s services to build a web app that gives people an emotional boost in the form of affirmations, short poems, haiku’s, facts and quotes, and so on.

What I ended up realizing while doing this experiment was that OpenAI’s services didn’t just generate such emotional boosts for users of the web app, but they actually ended up boosting my own productivity by leaps and bounds, thus providing me with my own emotional boost!

Allow me to present “AI”ffirmations — a toy web app that generates an endless supply of emotional boosts (affirmations, poetry, haikus, facts and quotes); about life, love, money and the world; powered by AI!

Without further ado, let me start with a demo!

Demo of AIffirmations

Demo of AIffirmations — the web app that generates an endless supply of emotional boosts (affirmations, poetry, haikus, facts and quotes) about life, love, money and the world, using AI!

As simple as that!

Just select what you want the emotional boost about and the type of boost you desire, and voila! Within moments, you get something that you would probably find on a poster or a greeting card!

Ok, so it’s not Shakespeare, and in some cases it might even be a bit cheesy, but it is certainly better than reading the news, right? 😊

Even a cheesy, simply worded affirmation, delivered at the right time, can make a difference to someone who is struggling.

What’s more, these are still early days for AI, particularly when it comes to creativity.

It will get better. Likely even a lot better.

Emotional Boosts for Humans, Courtesy of AI

While we can certainly expect these to improve in the future, for now, here are some examples of emotional boosts generated by this app:

A) Examples of Affirmations:

I am grateful for what I have and what is coming my way.

I am grateful for the amazing life I have been blessed with, and I choose to embrace each moment with love, joy, and enthusiasm.

I am grateful for the beauty and richness of life, and I am confident that I can create the life I desire.

B) Examples of Short Poems and Haikus:

Life is ever-changing

Flowing in an endless stream

Cherish each moment.

Love is sweet and gentle

A flame that warms the coldest heart

A blessing from above.

The world is vast and ever-changing,

A place of beauty, joy, and strife.

Though darkness looms, we keep on hoping,

For a better future, free from strife.

Not bad for this new type of “artificial” intelligence that’s just waking up, right?

But that’s not even the best part!

I realized something even more interesting while developing it.

Boost Not Just Your Mood, But Also Your Productivity!

Ok, now that we have seen what the app can do, let us get down to how I built it.

I had seen people talk about using ChatGPT to write code, so I decided to give that a try.

This approach to development is new even for me.

Normally I would have searched the internet for tutorials and blogs and discussion threads to learn how to do something, but using a chatbot to do it was a totally new experience.

And as you will see below, this approach turned out to give an incredible boost to my productivity!

It saves you all the searching and browsing through various API guides and developer forums one normally would have to, and then trying adapt the information you find there to your specific problem.

Instead, it directly gives you the actual code you need, specific to your situation, already formatted the way you want it, and even gives you helpful descriptions to boot!

So let me describe how the development process went.

A Day in the Life of a Developer, Circa 2023

To start with, I looked on OpenAI’s website to see what they recommended as a good way to build a web app that calls their API.

Their tutorial used Python and Flask.

(Just for completeness, let me say that Flask is a simple framework for writing web apps or web services in Python.)

So I asked ChatGPT:

Write a simple web app using Python and Flask.

And within moments, it responded with the following:

A simple but complete web app using Python and Flask, courtesy of ChatGPT

This was great! I can absolutely see someone who doesn’t know anything about Flask getting up to speed right away with this start.

But when I saw how helpful ChatGPT was, I got greedy!

I thought, if it’s blowing my expectations with such a high level of helpfulness, why not just ask it for the world?

If you don’t ask, you don’t get, right?

So then I asked for the whole world!

Write code using Flask and Python to call the OpenAI Completions endpoint. Make sure it handles any errors and exceptions.

And it responded with exactly what I asked:

Complete code for calling OpenAI’s Completions endpoint in Python and Flask, courtesy of ChatGPT

This was incredible! I basically had the skeleton of the entire app!

With a few minor tweaks and additions (like obtaining an API key and setting it in the code etc.), it was already working.

Then it was just a matter of combining it with the UX from the previous query, adding the appropriate form fields, and generally making it look reasonably nice using CSS and so on, I had the whole app working in my development environment.

Of course, I could have just asked it to give me the full UX with CSS etc. also, but it was just too easy to add it myself instead of thinking about how exactly to specify the UX I wanted at the level of detail that would have been needed.

Plus there is always a bit of trial and error when it comes to UX development.

This is an interesting discovery, though.

Sometimes, for complicated scenarios, creating the precise and fully detailed prompt for what you want feels like more work than just doing it yourself!

Would I be able to generate the complete working final code for a non-trivial app by just specifying what I want in great detail and would that be too much effort?

Would that require the development of a new high level prompting language? (Prompthon anyone?)

Or maybe just pseudocode?

Or maybe just go with “no-code” solutions that have been growing in popularity anyway?

I suppose this is something to think about. I might write about that in the future.

This also makes it clear that, for ChatGPT type AI tools, making the jump from a programmer’s assistant or “copilot” to full production level programmer may be a difficult challenge.

Of course, I suppose we will get to see what the OpenAI folks have up their sleeves in the not too distant future.

Next Up: Deployment?

Anyway, now that I have the app running in my dev environment, I suppose the next thing I could ask ChatGPT is to show me how to deploy it to the internet for public consumption.

But I need to be careful here because, while ChatGPT is still free, the API is metered.

I don’t want to incur unnecessarily high costs for a toy app that is really meant to be just for demo purposes.

Also, when one talks about public consumption, one has to cross a certain quality bar — not just in terms of service robustness, but also the quality of the content.

Some of the emotional boosts generated by the API aren’t that great.

So some sort of curation will need to be implemented before it is opened to the public, even as a beta.

I also want to develop the app further over the next few posts, adding more features to make it even more fun and useful.

So we will see which way I feel is best to go. (And whether AI will help in unexpected ways to make that decision for me!)

I also intend to open source the app once it is in better shape. (And I do know that ChatGPT will help me to get it into better shape, by providing helpful comments for the code and generally beautify the code!)

The upshot is that this really feels like a new paradigm in software development.

Don’t search, read, and adapt, just get exactly what you need for your specific situation.

Will it scale for problems that are more complex than toy apps?

Will it work for production quality work?

Will AI turn me into a more productive developer or will it make me lazier?

Only time will tell. 😊

Stay tuned! (And boosted, in more ways than one!)

You can always rely on the sun for your daily emotional boost. Failing which, there’s AI. (Image by 🌼Christel🌼 from Pixabay)

--

--

Vin Bhalerao

I write about science / engineering and their significance and value in our lives. | My book: “An Engineer’s Search for Meaning” (https://meaning.lifevisor.ai).