Monday, December 5, 2022
HomeData ScienceI Used ChatGPT to Create an Total AI Software on AWS |...

I Used ChatGPT to Create an Total AI Software on AWS | by Heiko Hotz | Dec, 2022


This new language mannequin could possibly be the pair programmer of your selection going ahead

Picture by writer — created with Secure Diffusion

Two days in the past OpenAI launched ChatGPT, a brand new language mannequin which is an improved model of GPT-3 and, probably, provides us a peek into what GPT-4 can be able to when it’s launched early subsequent (as is rumoured). With ChatGPT it’s potential to have precise dialog with the mannequin, referring again to earlier factors within the dialog.

I needed to check out if I might use this mannequin as a pair programmer that I may give some directions and it produces the code for me. I might nonetheless double-check these code snippets, after all, however no less than I gained’t have to jot down them from scratch anymore.

So on this weblog publish I describe how I used ChatGPT to create a easy sentiment evaluation software from scratch. The app ought to run on an EC2 occasion and utilise a state-of-the-art NLP mannequin from the Hugging Face Mannequin Hub. The outcomes have been astonishing 😮

Full disclaimer — I needed to try to refine the prompts a number of occasions to get the outcomes I needed. That being stated, it normally took solely minor refinements to get the specified outcomes. My prompts and the code generated by the mannequin might be discovered on this GitHub repo.

You’re joking, proper?

Okay, let’s get began! Let’s first test if ChatGPT is prepared to assist:

Picture by writer

Okay, this can be a promising begin 😊 Let’s dive into the small print, as requested by our companion!

We wish to run this software on an EC2 occasion, however we don’t wish to click on by way of the AWS console to create this EC2 occasion. Due to this fact, our first job for ChatGPT is to create a CloudFormation template that units up the EC2 occasion:

Picture by writer

The instruction are somewhat particular (I needed to search for the AMI ID myself, for instance), however nonetheless I used to be fairly shocked that it got here out with an virtually excellent CF template. Word that ChatGPT additionally places some disclaimers on the finish of the code:

Picture by writer

All the code produced by ChatGPT:

Word that the EC2 occasion really doesn’t obtain the identify we specified within the immediate. However okay, let’s reside with that for now. One other “bug” on this template is that the pre-installed Pytorch setting on the AMI known as “pytorch” not “pytorch_36”. Let’s repair that by changing the setting identify.

Now, how can we really run this? Let’s ask ChatGPT:

Picture by writer

Okay, working this line kicked off the Stack creation utilizing the CF template. After a couple of minutes we see the EC2 occasion is up and working. Word that the template created a safety group and the EC2 occasion used that safety group like specified:

Picture by writer

Let’s additionally SSH into the EC2 occasion to see if the packages we’d like are put in:

Picture by writer

Appears like all the pieces is about up for the Streamlit app 😊

Now we’d like an software that runs on Streamlit and that analyses the sentiment of textual content. To my shock this was even simpler than I anticipated:

Picture by writer
Picture by writer

Once more, good disclaimer on the finish.

All the code:

This really seems good to me, let’s attempt to run this with out modifications. Copy and pasting this code right into a file on EC2 referred to as “app.py”. However how can we run Streamlit apps once more? Let’s ask our “colleague”:

Picture by writer

We have already got Streamlit put in so let’s go forward and run “streamlit run app.py”:

Picture by writer

Appears all good!

Now comes the second of fact. We plug within the URL streamlit uncovered and see if the app runs.

Picture by writer

Wow, ChatGPT simply constructed a whole textual content sentiment app simply with our directions 🤯

I’m very a lot speechless. This has been a lot enjoyable and the probabilities are countless. I’ll attempt to experiment extra with this mannequin going ahead and would additionally love to listen to what you will have constructed with it. Please remark under!

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments