Using GenAI to Classify an Image as a Photo, Screenshot, or Meme

File this under the "I wasn’t sure if it would work and it did" category. Recently, a friend on Facebook wondered if there was some way to take a collection of photos and figure out which were ‘real’ photos versus memes. I thought it could possibly be a good exercise for GenAI and decided to take a shot at it. As usual, I opened up Google’s AI Studio and did a few initial tests: I then simply removed that image and pasted more info to test. From what I could see, it worked well enough. I then took the source code from AI Studio and began working. The Code # First, I grabbed some pictures from my collection, eleven of them, and tried to get a few photos, memes,... more →
Posted in: JavaScript

Date.now()

Ask any software engineer and they’ll tell you that coding date logic can be a nightmare. Developers need to consider timezones, weird date defaults, and platform-specific date formats. The easiest way to work with dates is to reduce the date to the most simple format possible — usually a timestamp. To get the immediate time in integer format, you can use Date.now: const now = Date.now(); // 1705190738870 I will oftentimes employ Date.now() in my console.log statements to differentiate likewise console.log results from each other. You could also use that date as a unique identifier for an event in a low-traffic environment. The post Date.now() appeared first on David Walsh Blog. David... more →
Posted in: JavaScript

Thoughts on Streaming Services: 2024 Edition

Streaming services have revolutionized content delivery, sending linear media companies into a panic as they watch traditional cable services decay. “Cutting the cord” is a common practice these days, but the streaming landscape isn’t perfect. We’re a decade into streaming so I wanted to share my thoughts on the state of new media: first impressions, second thoughts, and the third degree! Netflix is king thanks to having first mover advantage, and making smart financial moves over the past six months, but Netflix’s content is unremarkable. Their recent wins are USA’s Suits and content licensed from Max…they need to do better… The biggest loser... more →
Posted in: JavaScript

Using AI and PDF Services to Automate Document Summaries

I first discovered Diffbot way back in 2021 when I built a demo of their APIs for the Adobe Developer blog ("Natural Language Processing, Adobe PDF Extract, and Deep PDF Intelligence"). At that time, I was impressed with how easy Diffbot’s API was and also how quickly it responded. I had not looked at their API in a while, but a few days ago they announced new support for summarizing text. I thought this would be a great thing to combine with the Adobe PDF Extract API. Here’s what I found. First off, if you want to try this yourself, you’ll need: Adobe PDF Services credentials. These are free and you get 500 transactions per month for free. For folks who may not know,... more →
Posted in: JavaScript

The Return of the Comment(s)

In the twenty plus years this blog has been around, I’ve had various different comment systems. Initially, I simply stored them in a database (this blog used to be powered by ColdFusion), but eventually moved to Disqus. I had a pretty huge amount of comments and was generally OK with the service, but eventually, folks simply stopped commenting. I then made the decision to simply kill off the integration. I wrote some scripts to get my data, stored them as flat files, and you can still see the old comments on posts that had them. About a year or so I added in Webmentions, which works ok, but doesn’t really feel the same. After some time thinking about it, I decided maybe its time to... more →
Posted in: JavaScript

Function Calling and GenAI

I love when I work on one demo, hit an issue, discover something else and get joyfully distracted into learning something completely different. In this case, it was a suggestion to help with an issue I was having with output from a prompt, and while it wasn’t a good solution for what I was doing, it was an eye-opening look at a really cool feature of Generative AI – Function Calling. Now, I’m new to GenAI, and new to this particular feature having been introduced to it a bit less than twenty-four hours ago. I know it’s supported by Google AI APIs as well as OpenAI and a quick search around other offerings seems to imply it’s a universal thing. I want to give a quick... more →
Posted in: JavaScript

My 2023

Happy New Year (well almost) my fabulous readers. Typically at the end of the year, I like to take stock of what I accomplished through the year and share it in one last blog post. I honestly don’t expect anyone to actually read these summaries, but they help me determine what I did well and what I didn’t accomplish over the year while figuring out what I want to adjust for next year. So here’s how I did in 2023. Writing # My goal for the blog is consistent, useful, helpful, and fun posts. My publishing ‘plan’ is one post a week for 52 posts a year. Counting this post, I published 118 posts which I’ll take as a big ole win. My traffic, according to Netlify,... more →
Posted in: JavaScript

Using Generative AI to Detect Cat Breeds

Let’s be honest, what other use is there for generative AI than working with cats? If you read my previous post on Google’s Gemini AI launch, you may have seen my test prompts asking it to identify the kind of cat shown in a picture. I decided to turn this into a proper web application as a real example of the API in action. Here’s what I came up with. The Front End # For the front end, I decided to make use of a native web platform feature to access the user’s camera via a simple HTML form field. By using capture="camera" on an input tag, you directly get access to the device camera. There are more advanced ways of doing this, but for quick and simple, it works... more →
Posted in: JavaScript
1 3 4 5 6 7 76