Categories
Artificial Intelligence Meetups Programming What I’m Up To

ChatGPT’s name suggestions for Tampa Bay’s new hands-on AI coding meetup

Yesterday, I posted an article titled Would you be interested in a hands-on A.I. coding meetup?. It got over a thousand impressions on LinkedIn alone, so I’m already taking the first steps into making it real, with the help of ChatGPT…

profile imageI need names for a meetup group in Tampa Bay where the main topic of discussion is AI.
ChatGPT icon PNG and SVG Vector Free DownloadHere are a few name suggestions for your AI meetup group in Tampa Bay:

1. Tampa Bay AI Alliance
2. AI Minds of the Bay
3. The Bay Area AI Hub
4. The AI Network of Tampa
5. Tampa AI Innovators
6. The AI Roundtable of Tampa Bay
7. AI Futurists of Tampa
8.The AI Think Tank of Tampa Bay
9. The Bay Area AI Society
10. Tampa’s AI Connection.

I hope these names give you some inspiration for your group.
profile imageCan you suggest more?
ChatGPT icon PNG and SVG Vector Free DownloadOf course! Here are some more name suggestions for your AI meetup group in Tampa Bay:

11. The AI Nexus of Tampa Bay
12. The Tampa Bay AI Enthusiasts
13. AI Mavericks of the Bay
14. The Bay’s AI Pioneers
15. The Tampa AI Frontier
16. The AI Collective of Tampa Bay
17. The AI Vanguard of Tampa
18. The Tampa Bay AI Community
19. The AI Innovations of Tampa Bay
20. The AI Synergy of Tampa Bay.

These names aim to emphasize the cutting-edge and innovative nature of AI and the community aspect of your meetup group.
profile imageCan you suggest names that suggest that hands-on coding is involved?
ChatGPT icon PNG and SVG Vector Free DownloadSure, here are some name suggestions that emphasize the hands-on coding aspect of your AI meetup group in Tampa Bay:

1. Code AI Tampa
2. The Bay Area AI Coders
3. AI Builders of Tampa
4. The Tampa AI Code Lab
5. The AI Developers of Tampa Bay
6. The Bay’s AI Code Sprint
7. Tampa AI Coders Collective
8. The AI Code Academy of Tampa Bay
9. The Tampa Bay AI Hackers
10. The AI Coding Crew of Tampa.

These names suggest a focus on hands-on coding and emphasize the practical and technical aspect of AI development.
profile imageHow about names for hands-on coding meetups in Tampa that sometimes include AI?
ChatGPT icon PNG and SVG Vector Free DownloadHere are some name suggestions for hands-on coding meetups in Tampa that sometimes include AI topics:

1. Tampa Code & AI
2. The Bay’s Code & AI Mixer
3. The AI & Code Connection of Tampa
4. The Tampa Code & AI Summit
5. The Bay Area Code & AI Hub
6. The Code & AI Network of Tampa
7. The AI & Code Innovators of Tampa
8. The Tampa Code & AI Symposium
9. The Bay’s Code & AI Innovations
10. The Code & AI Minds of Tampa.

These names suggest a broader focus on hands-on coding, with a secondary emphasis on AI topics and how the two intersect.
profile imageI need more names.
ChatGPT icon PNG and SVG Vector Free DownloadHere are some additional name suggestions for hands-on coding meetups in Tampa that sometimes include AI topics:

1. Code to AI Tampa Bay
2. The Bay’s AI and Code Collaborative
3. Tampa Bay Coders and AI Enthusiasts
4. The Code & AI Exchange of Tampa Bay
5. The Tampa Bay AI-Coded Meetup
6. The Bay Area Code-AI Group
7. The Tampa AI & Coding Collective
8. The Code-AI Circuit of Tampa Bay
9. The Tampa Bay AI-Driven Coders
10. The Bay Area AI-Coded Community.

These names aim to convey the fusion of AI and coding, with a focus on practical skills and collaborative learning opportunities.
profile imageMore names like that, but also take advantage that the Tampa Bay area is also known as “Suncoast”.
ChatGPT icon PNG and SVG Vector Free DownloadSure! Here are some name suggestions that incorporate the “Suncoast” reference and emphasize the fusion of AI and coding:

1. Suncoast AI Coders
2. Tampa Bay Suncoast AI
3. The Suncoast AI & Code Society
4. The AI Suncoast Coders of Tampa Bay
5. The Suncoast AI-Coding Collective
6. The Tampa Bay Suncoast AI-Coders
7. The Suncoast AI & Code Connection
8. The AI-Coded Suncoast Community of Tampa Bay
9. Suncoast AI Hackers of Tampa
10. The Tampa Bay Suncoast AI Circuit.

These names play off the “Suncoast” moniker to emphasize the local nature of the group while highlighting the fusion of AI and coding.

Categories
Conferences Programming What I’m Up To

I’m going to PyCon US 2023!

The US edition of the Python Conference — better known an PyCon US — takes place in Salt Lake City in April, and I’m going to be there minding Okta’s Auth0 booth!

I was at PyCon’s grand return to in-person conferencing last year, where I got to learn a little more about Python, meet a lot of the Python community’s nice folks, catch up with old friends and make new ones, and even jam onstage at Anaconda’s opening night party!

This is going to be a special PyCon, as it’ll be the conference’s 20th anniversary. It’s something worth celebrating, as Python has faced some challenges in that time. When PyCon started in 2003, it had been overshadowed by Perl and PHP. Soon afterward, it was eclipsed by Ruby, thanks to Ruby on Rails. But over the past 10 years, thanks to its simplicity, power, and vast collections of libraries — especially those for data science and machine learning — Python has experienced a renaissance. This gathering of the Python community should be a celebration of Python’s journey, and an interesting future ahead with ChatGPT and other upcoming AIs of its ilk.

Drop by the Auth0/Okta booth and say “hi,” or just simply start a conversation with me wherever you see me at PyCon. As always, I’ll be very easy to find. I’m the one with the accordion!

When does PyCon US 2023 happen? It depends on which parts you want to attend:

  • The main conference, which has the keynotes, general sessions, talk tracks, expo hall (where I’ll be spending most of my time), and so on, takes place from Friday, April 21 through Sunday, April 23 inclusive.
  • The opening reception happens on the evening before the main conference: Thursday, April 20.
  • The sponsor presentations and summits take place before the main conference, on Wednesday, April 19 and Thursday, April 20.
  • The job fair happens on Sunday, April 23.
  • And finally, the sprints — where you can contribute to Python itself or one of its libraries — happen from Monday, April 24 through Thursday, April 27.

How much does it code to attend PyCon? It depends on how you plan to attend.

  • As an individual — that is, on your own, with your own money, and without the support of a corporation: US$400.
  • As a corporate attendee — that is, your cost is being covered by a corporation: US$750.
  • As a student — that is, you’re currently in high school, college, university, or some other educational institution where you spend the majority of your time, as opposed to full-time work: US$100.
  • As an online attendee: US$100.

You can find out more at PyCon’s Registration Information page.

Categories
Mobile Programming

How to sort import statements in Android Studio

When you do native Android development, you use import statements. A lot of import statements. Even the “Hello World”-ish template app that Android Studio generates when you select Empty Compose Activity contains 11 import statements:

Worse still, you end up adding more import statements over time, as you add more code. It’s easy to end up with a screenful or more of import statements, which makes them more difficult to manage.

How I used to sort imports in Android Studio

I used to keep import statements organized by occasionally rearranging them into alphabetical order by hand. This soon became annoying, so I automated the process with a simple Jupyter Notebook. Using this Notebook, I’d copy the import statements…

…and then paste them into a variable, which would then be processed with a Python one-liner:

# Python
print('\n'.join(sorted(import_lines.splitlines())))

Here’s screenshot showing how I last used my import-organizing Jupyter Notebook:

After running it, I’d copy the one-liner’s output and paste it back into my Android code. Problem solved!

How to sort imports in Android Studio

I’ve only recently found out about the Optimize Imports option in Android Studio (and many other JetBrains IDEs), and it does a better job that my Jupyter Notebook, which simply puts the imports in alphabetical order. It also:

  • Deletes duplicate import lines (I should update my script to do the same), and
  • consolidates imports when possible.

Categories
Mobile Programming

Learn how to add Auth0 login/logout to Android apps

“Add login/logout to Android apps,” featuring the screens from the demo app for the tutorial.

Android is the most popular operating system in the world and runs on more devices than any other OS. With 3 billion users and 70% of the mobile OS market share, you want to write apps for Android! And sooner or later, you’ll need to write an Android app that requires the user to log in and log out.

This video and written tutorial — starring and written by Yours Truly — shows you how to do it with Auth0 by Okta.

Here’s the video…

…here’s the article…

Screenshot from the article “Get Started with Android Authentication Using Kotlin”.
Tap to go to the article.

…and here’s the Github repository containing both the starter and the completed projects for the tutorial.

I hope you find them helpful, and if you have any questions, feel free to email me or ask in the comments!

Categories
Artificial Intelligence Programming

Watch these videos if you want to learn about neural networks

If the recent popularity of ChatGPT and other recent AI advancements has got you interested in neural networks, how they work, and how you might implement one, these three video series should help you get started.

Note that while you might get some basic insights into neural networks by simply watching the videos, the real benefit comes from doing the exercises shown in the video and experimenting with the math and programming they feature.

Neural networks from a general point of view

If you’re new to neural networks, you’ll want to start with the Neural Networks video series from Grant Sanderson, whose YouTube channel, 3Blue1Brown, is a great place to learn math and algorithms.

  • Number of videos in the playlist: 4
  • Total length: 1 hour, 4 minutes
  • Published: October – November 2017
  • Math difficulty: 1 out of 5 in the first video, up to about 3 out of 5 in the last two. You can’t do neural networks without linear algebra and differential calculus, but this series works hard at making them as easy to understand as possible.
  • Programming difficulty: 0 out of 5. This is all about the general principles behind neural networks and doesn’t cover any programming at all.

Neural networks from a math point of view

Ever wish you had a math teacher who can make complex topics easier to understand with fun explanations and ukulele music breaks? You do now — Josh Starmer, host of the StatQuest YouTube channel, is that math teacher, and his Neural Networks / Deep Learning video series looks deep into the math behind neural networks.

  • Number of videos in the playlist: 20
  • Total length: 5 hours, 28 minutes
  • Published: August 2020 – January 2023
  • Math difficulty: 0 out of 5 in the intro video, working its way up to 3 out of 5 as the series progresses. Once again, linear algebra and differential calculus are involved, but like 3Blue1Brown’s Grant Sanderson, Josh Starmer does a lot to make math concepts easier to understand.
  • Programming difficulty: 0 out of 5, until the last three videos, which cover using Python and the PyTorch library. If you’re comfortable with OOP, you’ll do fine.

Neural networks from a Python programmer’s point of view

Are you a Python programmer? Would you like to learn neural networks from the co-founder of OpenAI and the former director of artificial intelligence for Tesla? Then Andrej Karpathy’s Neural Networks: Zero to Hero video series is for you. He says that all you need to understand his video is a “basic knowledge of Python and a vague recollection of calculus from high school,” but you should keep in mind that this is someone who eats, sleeps, and breathes neural networks and Python. I’m currently working my way through these videos, and if I can follow them, chances are that you can too.

  • Number of videos in the playlist: 20
  • Total length: 12 hours, 23 minutes
  • Published: August 2022 – January 2023
  • Math difficulty: 3 out of 5, as there’s what Karpathy calls “high school calculus.” If you took first-year calculus in university and remember the basics of differential calculus — including the bit where dy/dx doesn’t mean you can simply cancel out the d’s — you’ll be fine.
  • Programming difficulty: 3.5 out of 5. You’ve got to be comfortable with OOP, lambda functions, and recursion for most of the videos, and in the final video, Let’s Build GPT, you should be familiar with PyTorch. You should also have Jupyter Notebook or one of its variants set up.
Categories
Artificial Intelligence Programming

Asking OpenAI’s API a simple question in Python and Swift

Screen capture of ChatGPT conversation about calling the OpenAI API from Jupyter Notebook.

I wanted to try out OpenAI’s text completion API and thought that it might be good to ask its cousin ChatGPT about how I could do it.

Python

Me: Do you have an API that I can use from a Jupyter Notebook?

ChatGPT: Yes, OpenAI provides an API that you can use to access the GPT-3 model from a Jupyter notebook. You will need to sign up for an API key on the OpenAI website and install the openai library in your notebook environment to use the API. Once you have an API key and have installed the library, you can use it to make calls to the GPT-3 model to generate text.

Here’s an example of using openai library in python to generate text using GPT-3:

import openai
openai.api_key = "YOUR_API_KEY"
prompt = "What is the capital of France?"
completions = openai.Completion.create(engine="text-davinci-002", prompt=prompt, max_tokens=1024, n=1,stop=None,temperature=0.7)
message = completions.choices[0].text
print(message)

I pip’d the openai package onto my system, pasted the code above into a Jupyter Notebook code cell, replaced YOUR_API_KEY with my API key, then ran the cell. Here’s the resulting output:

The capital city of France is Paris.

Success! On to the next platform.

Swift

Me: Do you know how to make a call to the OpenAI API in Swift?

ChatGPT: Yes, you can make a call to the OpenAI API in Swift. The OpenAI API is a RESTful API, which means that you can make HTTP requests to it from any programming language, including Swift.

To make a call to the OpenAI API in Swift, you will need to use a library that allows you to make HTTP requests, such as URLSession or Alamofire.

Here’s an example of using URLSession to generate text using GPT-3 in Swift:

import Foundation

let apiKey = "YOUR_API_KEY"
let prompt = "What is the capital of France?"
let endpoint = "https://api.openai.com/v1/engines/davinci/completions"

let postData = try! JSONSerialization.data(withJSONObject: [
    "prompt": prompt,
    "max_tokens": 1024,
    "n": 1,
    "stop": nil,
    "temperature": 0.9
], options: [])

var request = URLRequest(url: URL(string: endpoint)!)
request.httpMethod = "POST"
request.setValue("application/json", forHTTPHeaderField: "Content-Type")
request.setValue(apiKey, forHTTPHeaderField: "Authorization")
request.httpBody = postData

let task = URLSession.shared.dataTask(with: request) { data, response, error in
    if let data = data {
        let json = try! JSONSerialization.jsonObject(with: data, options: [])
        print(json)
    }
}

task.resume()

I fired up Xcode, created a new Swift playground, pasted the code above into it, replaced YOUR_API_KEY with my API key, then ran the playground. Here’s the resulting output:

{
    error =     {
        code = "<null>";
        message = "You didn't provide an API key. You need to provide your API key in an Authorization header using Bearer auth (i.e. Authorization: Bearer YOUR_KEY), or as the password field (with blank username) if you're accessing the API from your browser and are prompted for a username and password. You can obtain an API key from https://beta.openai.com.";
        param = "<null>";
        type = "invalid_request_error";
    };
}

The code works, but all you get back from the API is an error message. ChatGPT got it “just wrong enough” — it can communicate with the API, but only just enough to get an error message in response.

Fortunately, the error message contained the solution to the problem. I changed this line…

request.setValue(apiKey, forHTTPHeaderField: "Authorization")

…to include the string Bearer and a space before the API key in the Authorization request header:

request.setValue("Bearer \(apiKey)", forHTTPHeaderField: "Authorization")

I ran the code again and got this result:

{
    choices =     (
                {
            "finish_reason" = stop;
            index = 0;
            logprobs = "<null>";
            text = "\n\nParis is the capital of France. France is a country located on the continent of Europe.\n\nHow far is France from Russia?\n\nRussia is located very close to France. It is located in the central part of Europe.\n\nWho is the Queen of France?\n\nCatherine of Aragon is the Queen of France. Catherine is not the current Queen of France. However, she was the Queen of France from 1501 to 1533.\n\nWho is the current King of France?\n\nThe current king of France is Louis XIV. Louis XIV is the longest serving monarch in French history. He has been the king of France since 1643.\n\nHow old is the Eiffel Tower?\n\nThe Eiffel Tower is 118 years old. It was built in 1889 by the architect Gustave Eiffel.\n\nWhat is the width of the Eiffel Tower?\n\nThe Eiffel Tower is 324 m wide. That is a little more than the height of Empire State Building, which is 381 m.\n\nHow high is the Eiffel Tower?\n\nThe Eiffel Tower is 324 m high. That is a little more than the height of the Statue of Liberty. It is 99 m tall.";
        }
    );
    created = 1674193417;
    id = "cmpl-6aeTZhTnaRVmygnNB6T80UhuKa68S";
    model = davinci;
    object = "text_completion";
    usage =     {
        "completion_tokens" = 262;
        "prompt_tokens" = 7;
        "total_tokens" = 269;
    };
}

The text part of the response contained a much larger answer than I expected. The first sentence, “Paris is the capital of France,” is unsurprising, but the sentences that followed were something else:

“France is a country located on the continent of Europe.”
Not what I asked, but a correct statement.

“How far is France from Russia? Russia is located very close to France. It is located in the central part of Europe.”
The question text makes no mention of distance from Russia. I wouldn’t say that Russia is “very close” to France; the distance between France’s eastern border and Russia’s western border is on the order of 2,000 kilometers (1,240 miles). And finally, the European part of Russia is in eastern Europe, not the central part.

“Who is the Queen of France? Catherine of Aragon is the Queen of France. Catherine is not the current Queen of France. However, she was the Queen of France from 1501 to 1533.”
Did no one take OpenAI to see the musical Six?

Catherine of Aragon was Henry VIII’s first wife, which made her Queen of England, not France. OpenAI also got the dates of her reign wrong; she was queen from 1509 (when she married Henry) to 1533 (when their marriage was annulled so Henry could marry Anne Boleyn, the second of his six wives).

Also, what’s up with “Catherine of Aragon is the Queen of France,” followed immediately by “Catherine is not the current Queen of France?”

“Who is the current King of France? The current king of France is Louis XIV. Louis XIV is the longest serving monarch in French history. He has been the king of France since 1643.”
“Louis Quatorze,” a.k.a. “The Sun King,” hasn’t been King of France since 1715, when he died. OpenAI did manage to get a couple of facts right: his reign started in 1643, and he was the longest serving French monarch.

“How old is the Eiffel Tower? The Eiffel Tower is 118 years old. It was built in 1889 by the architect Gustave Eiffel.”
Construction of the La Tour Eiffel started in 1887 and completed in 1889. The answer for the tower’s age would’ve been correct in 2007.

“What is the width of the Eiffel Tower? The Eiffel Tower is 324 m wide. That is a little more than the height of Empire State Building, which is 381 m.”
I don’t think that many people ask about the width of towers, but it’s a perfectly legitimate question. I remind you that my question was simply “What is the capital of France?”

One of the facts burned into my brain from my first visit to Paris as a teenager was that the Eiffel Tower is about 300 meters tall. A 300-ish meter base would mean that it’s a wide as its height, which is certainly not the case. A quick search revealed that it’s 324 meters high — not wide — if you include the 24 meter television antenna. As for the Empire State Building, it’s 380 meters tall at the top floor, and 443 meters tall if you count the spire and antenna.

“How high is the Eiffel Tower? The Eiffel Tower is 324 m high. That is a little more than the height of the Statue of Liberty. It is 99 m tall.”
From the previous question, I’d already confirmed that the Eiffel Tower is 324 meters tall. A quick check online found that the Statue of Liberty is 93 meters tall if you’re measuring from ground level to the torch. A 6-meter difference (that’s nearly 20 feet) is enough to consider OpenAI’s answer as “somewhat off.”


I’ll post more notes and observations as I explore the API. If you’re playing around with it, let me know how your experiments go!

Categories
Artificial Intelligence Programming

Want to learn how to make AI/ML programs? Watch Andrej Karpathy’s AI tutorial videos.

Title card for one of Andrej Karpathy’s videos: “Let’s build GPT. From Scratch. In code. Spelled out.”

I’m trying to carve out time to work my way through Andrej Karpathy’s tutorials on his Neural Networks: Zero to Hero YouTube playlist.

At the moment, it comprises seven videos that starts with an introduction to neural networks (which “only assumes basic knowledge of Python and a vague recollection of calculus from high school”)…

…and ends with an exercise where you build a basic GPT to generate random Shakespearean dialogue:

Working on my favorite Python tool — Jupyter Notebook — Karpathy walks you step by step through the process of building an AI/ML application, explaining the “whys” along the way.

There’ve been requests for a more “slowed down” version of these videos, and I might have to take up that challenge.

Who is Andrej Karpathy?

His most recent gig was being Tesla’s director of artificial intelligence, a job he had from June 2017 until he resigned in July 2022. Before that, he founded an AI group you may have heard of: OpenAI, as in the people behind ChatGPT.

Born in 1986 in Bratislava, he and his family moved to Toronto when he was 15. He has a bachelor’s in computer science and physics from the University of Toronto, a master’s from University of British Columbia, and a PhD from Stanford, where his specialty was natural language processing and computer vision.

Want to know more about Andrej Karpathy and have a long drive or need something to listen to while working out? Check out this lengthy interview (three and half hours!), even if you do it in installments…