ChatGPT is an amazing AI service created by OpenAI. It has ushered us into the next generation of search engines that is powered by LLM (Large Language Models) and NLP systems.
Let us explore this awesome service. First of all you will need to create an account (email and phonenumber as well as the basic username) in order to use this service. This makes sense to collect all these details for security purposes and to avoid abuse.
General Overview
ChatGPT Overview
Testing ChatGPT to Design a Streamlit App
Let us actually try out the code given by ChatGPT
import streamlit as st import numpy as np import matplotlib.pyplot as plt st.title("Streamlit App") # Create a slider slider = st.slider("Select a value", 0, 100) # Create a plot based on the value of the slider x = np.linspace(0, 10, 100) y = x**2 fig, ax = plt.subplots() ax.plot(x, y) st.pyplot(fig)
After following the instructions on how to run it above
This is quite impressive.
Building 5 Apps with ChatGPT
Let us give it a bit harder but useful task – A Sentiment Analysis App. We will first start with streamlit, then in flask, nodejs and then in a more difficult option such as Carbon language or Julia.
In running the code generated by ChatGPT, it actually works.
We will then repeat the same in Flask and Julia
ChatGPT even gave me the html code for the frontend
Let us try it in Express or Nodejs
ChatGPT on a more recent programming language
Let us try it on Carbon language
For those who are familiar with Carbon here is the code as copy and paste. Let us know if it actually works.
import "textblob" fn main() { form { textarea name="text" submit "Analyze" } let text = form.text let analysis = TextBlob(text) let sentiment = analysis.sentiment.polarity if sentiment > 0 { result = "Positive" } else if sentiment == 0 { result = "Neutral" } else { result = "Negative" } p "Sentiment: " + result + " (" + sentiment + ")" }
Finally we will try it with Julia
using Flux using MLJ using MLJModels using MLJSentimentAnalysis using TextAnalysis function sentiment_analysis_app() form = @form(:post, "/") do textarea("text") submit("Analyze") end if form.submitted text = form.params.text sentiment_model = SentimentAnalysis.SentimentAnalysis() sentiment = sentiment_model(text) if sentiment > 0 result = "Positive" elseif sentiment == 0 result = "Neutral" else result = "Negative" end p("Sentiment: $result ($sentiment)") end end using Flux.Tracker: @epochs sentiment_analysis_app() @epochs 1 Flux.train!(sentiment_analysis_app, Flux.ADAM(), loss)
To stretch the limits of ChatGPT, I asked it to compile each source code into a downloadable zip file and it did, however the links were not functionally which makes sense, since it is a free service.
We have seen how ChatGPT can be used to do some pretty incredible things. With great power comes great responsibility.
Happy ChatGPTing
Jesus Saves
Jesse E.Agbe(JCharis)