Using Transformers.js for AI in the Browser

Two weeks ago I had the pleasure of attending, and speaking at, connect.tech. One of the cooler presentations I saw was from Danielle Maxwell where she discussed usingAI in the browser and introduced me to Transformers.js. I’d heard of this before, but wasn’t quite aware of how easy it was to use. While this isn’t necessarily going to replace a "real" GenAI server, it does feel compelling enough to something to consider. As my readers know, I’ve been playing with Chrome’s attempt to bake this in as well, and while that’s not quite ready for real use yet, Transformers.js feels like something you could play with right now. How to get started? Using... more →
Posted in: JavaScript

Using Generative AI to Parse Web Pages into Data

A few months back, I took a look at using JSON-LD to turn a recipe web page into pure data: Scraping Recipes Using Node.js, Pipedream, and JSON-LD. This relied on a recipe actually using JSON-LD in the header to describe itself, which is pretty common for SEO purposes. Still, I was curious as to how well generative AI could solve this problem. In theory, this could be a good ‘backup’ in cases where a site wasn’t using JSON-LD and a general exploration of ‘parsing’ a web page into data. I’ll be using Google Gemini again, but in theory, this demo would work in other services as well. Here’s what I found. Converting a Web Page into Structured Data In order... more →
Posted in: JavaScript

Using Your Favicon for Monitoring Long Processes

A week or so ago, I was doing some tests on Google Colab and noticed something interesting. The notebook I was using was one that took one to two minutes to process. Before I’d start the process, the favicon looked like so: After kicking off the workflow, the favicon changed like so: To be honest, I had not noticed it earlier, but I only fairly recently started using a somewhat ‘slow’ notebook so it’s possible I just didn’t need it before. Realizing how it’s being used now, I thought it was an excellent user experience feature and looked into how to use it in my own applications. Changing the Favicon Ok, so this part is stupid easy. Assuming you’ve... more →
Posted in: JavaScript

Using Chrome AI for Translation

I’ve done a couple blog posts now on Chrome’s efforts to bring generative AI to the browser. It’s still somewhat of a rough process (remember, you can sign up for access to test and learn more at the intro post from the Chrome engineers), but it’s getting better over time. One thing I mentioned in my last post ("Using Chrome AI to Rewrite Text") was how the Chrome team is shipping focused APIs for specific purposes, not just general Q and A. In that previous post, I demonstrated an example of the Rewriter API. As yet another example of this, you can now test out on device translation. As with everything else I’ve shared in this space, you should consider... more →
Posted in: JavaScript

Using Parallel Requests to Improve Web Performance

Yesterday I blogged about a change I made to my bots page and in it, I mentioned how the performance wasn’t necessarily as good as it could be. I had made the decision to go from server-side and build-time for the page to a purely client-side solution. At the end of the post, I asked folks to let me know if anyone would like to have me work on that performance issue, and, honestly, it kept popping up in my head so I figured I should tackle it. Before I begin talking about what I changed, let me review what I had done, and what the issues are. The Current Solution You can go to the bots page yourself, but in general, this is the process: Given a list of bots… For each one, get the... more →
Posted in: JavaScript

Using Geocoding with Leaflet

When I first started talking about Leaftlet, I mentioned how it was "only" a map library, and by that I mean, only able to present a view/wrapper around tiles representing map data. There’s a heck of a lot of services that Google Maps, HERE, and so forth, add on top that won’t be present, things like routing, geocoding, and more. Considering the fact that Leaflet is, again, "only" a client-side JavaScript library, that’s just a fact of life. But I’ve been thinking about how I could integrate Leaflet with such services, and I thought I’d share a demo of just that – adding geocoding to Leaflet. WTF is Geocoding? Simply put, geocoding is converting... more →
Posted in: JavaScript

Using Chrome AI to Rewrite Text

Earlier this month, I discussed how Chrome’s upcoming built-in AI support was adding new features specifically tailored to certain use-cases. In that post, I looked at the Summarizer API. For today, I decided to take a look at the rewriter API. As a quick reminder, this is very early on, and if you want to try this yourself, you should hit the sign-up form and read the intro post from the Chrome folks first. Obviously, everything I’m going to show below probably will, almost certainly will, change before shipping. Ok, with that out of the way, let’s talk rewriting, specifically, how the Chrome API operates. Given a set of source input, the API can shorten, or lengthen the input,... more →
Posted in: JavaScript

Using Google Gemini’s File API with ColdFusion

I promise, I’m not turning this back into a ColdFusion blog, but as I prepare my presentation next week at Summit and update my Google Gemini code for some ColdFusion demos, I ran into a particularly gnarly bit that I wanted to share in a post. For the most part, I’ve had no issues using Gemini’s REST APIs in ColdFusion, but the File API ended up being more difficult. If you go the documentation for uploading, and use the ‘Shell’ language tab, you can see an example like so: MIME_TYPE=$ (file -b --mime-type "$ {IMG_PATH_2}")NUM_BYTES=$ (wc -c < "$ {IMG_PATH_2}")DISPLAY_NAME=TEXTtmp_header_file=upload-header.tmp# Initial resumable request... more →
Posted in: JavaScript
1 2 3 8