joe, to ai

LLaVA (Large Language-and-Vision Assistant) was updated to version 1.6 in February. I figured it was time to look at how to use it to describe an image in Node.js. LLaVA 1.6 is an advanced vision-language model created for multi-modal tasks, seamlessly integrating visual and textual data. Last month, we looked at how to use the official Ollama JavaScript Library. We are going to use the same library, today.

Basic CLI Example

Let’s start with a CLI app. For this example, I am using my remote Ollama server but if you don’t have one of those, you will want to install Ollama locally and replace const ollama = new Ollama({ host: 'http://100.74.30.25:11434' }); with const ollama = new Ollama({ host: 'http://localhost:11434' });.

To run it, first run npm i ollama and make sure that you have "type": "module" in your package.json. You can run it from the terminal by running node app.js <image filename>. Let’s take a look at the result.

Its ability to describe an image is pretty awesome.

Basic Web Service

So, what if we wanted to run it as a web service? Running Ollama locally is cool and all but it’s cooler if we can integrate it into an app. If you npm install express to install Express, you can run this as a web service.

The web service takes posts to http://localhost:4040/describe-image with a binary body that contains the image that you are trying to get a description of. It then returns a JSON object containing the description.

https://i0.wp.com/jws.news/wp-content/uploads/2024/05/Screenshot-2024-05-18-at-1.41.20%E2%80%AFPM.png?resize=1024%2C729&ssl=1

Have any questions, comments, etc? Feel free to drop a comment, below.

https://jws.news/2024/how-can-you-use-llava-and-node-js-to-describe-an-image/

ecmascript_news, to javascript
@ecmascript_news@mastodon.online avatar

ECMAScript 2025 feature: duplicate named capturing groups for regular expressions
@rauschma
https://2ality.com/2024/05/proposal-duplicate-named-capturing-groups.html

zalasur, to javascript
@zalasur@mastodon.surazal.net avatar

It's been almost a decade since I've done a live coding stream. This will be fun!

Today I'll be migrating my website from React to Lit, which is a lightweight framework built around web components. I have the scaffolding set up mostly, so now it's time to get this done.

Come watch. Ask questions in chat! You don't need to create an account, just a username is needed to participate.

https://video.surazal.net/w/5S7FPXJMZh1i1eqZLY9mcV

ecmascript_news, to javascript
@ecmascript_news@mastodon.online avatar
ecmascript_news, to javascript
@ecmascript_news@mastodon.online avatar
stefan, to javascript
@stefan@stefanbohacek.online avatar

I've been really enjoying working with Wikidata lately, setting up automated accounts like @libraries, @parks, and @lighthouses.

To see what else you can do with Wikidata, and to learn how to use it, check out a tutorial I put together: https://stefanbohacek.com/blog/making-a-map-of-unesco-world-heritage-sites/

HistoPol,
@HistoPol@mastodon.social avatar

@stefan

Excellent idea, Stefan. 👍

What is really missing in this global is a map of active and formerly prominent politicians per country with a Fedi presence (self-updating, preferably.)
I think, though, data is hard to come by (tried this 2 yrs ago for the US and EU for the DeadBirdSite, but stopped.)

@libraries @parks @lighthouses

ainali,
@ainali@social.coop avatar

@HistoPol @stefan @libraries @parks @lighthouses
Not for individual politicians or parties, but @govdirectory is aiming to get all public organizations (like government agencies and authorities) in the world and their contact data in one place, through Wikidata.

ecmascript_news, to javascript
@ecmascript_news@mastodon.online avatar
joelanman, to javascript
@joelanman@hachyderm.io avatar

trying to implement a form submission progress bar in js, but XHR follows the success redirect without telling me (I want to access it and redirect the browser).

Fetch can opt out of that but doesn't have a progress api!

I think I found a workaround for XHR:

xhr.onreadystatechange = function() {

 if (this.readyState === this.DONE) {  
 window.location.href = this.responseURL  
 this.abort()  
 }

}  

craigabbott, to javascript
@craigabbott@a11y.info avatar

I was today years old and 4 hours down when I learned you cannot deep clone an instance of a #JavaScript class 😩

craigabbott,
@craigabbott@a11y.info avatar

@joelanman tried lodash, it cloned some properties but not methods etc. ☹️

joelanman,
@joelanman@hachyderm.io avatar
chipx86, to Discord
@chipx86@mastodon.online avatar

Hey, developers: The @reviewboard team's starting a new for devs to hang out, chat, and share what you're building.

https://discord.gg/saMCqHEZ

We have channels for , , / , , , and more.

You don't need to use or contribute to Review Board to hang out. (But you can follow development there, if you want.)

We hope to see people come in and hang out. The aim is a friendly, diverse community of devs.

Feel free to pass along the invite!

stvfrnzl, to Blog
@stvfrnzl@mastodon.online avatar

Five years ago was my graduation from #CodingBootcamp on this very day.

I looked back and wrote a GIANT #blog post: https://stevefrenzel.dev/posts/from-boot-camp-to-blog-five-years-in-the-tech-industry/

Sit back, relax and enjoy the ride. #WebDev #Fullstack #Coding #Frontend #Backend #HTML #CSS #JavaScript

a11yclub, to CSS
@a11yclub@mastodon.social avatar

Just in: Alongside @karlgroves and @erikKroes, @5t3ph will also be offering a workshop in Amsterdam on 9 June:

Beyond : Requirements for Accessible Components

Participation in half-day workshops costs from € 25, full-day workshops from € 50. Further workshops can be added at any time. Get your tickets: https://ti.to/tollwerk/accessibility-club-summit-2024

More info: https://accessibility.club/event/accessibility-club-summit-2024#schedule-2024-06-09

MaxArt2501, to javascript
@MaxArt2501@mastodon.social avatar

A response to @cferdinandi 's recent post(s) on JavaScript and Web Components:
https://dev.to/maxart2501/javascript-is-not-the-problem-k4e

I know he didn't explain his position in details, so a 1800-word article sounds a little unfair, but I think dry and sharp statements need adequate context and analysis.

cferdinandi,
@cferdinandi@mastodon.social avatar

@MaxArt2501 @simevidas Sorry, re-reading this and realizing what you're asking. Payloads of that size are very common with React apps. Do they need that much? Of course not. But it would mean rebuilding them without React.

And back to my original point: a lot of that HTML doesn't and shouldn't require JS at all. JS is in fact the problem.

callionica,
@callionica@mastodon.social avatar

@cferdinandi @MaxArt2501 @simevidas I think Massimo is generally making the point that some web sites require JS for core activities, not as a design choice, but out of technical necessity. (My own example: media player). Once you accept that JS is required on a site, you make different decisions about web component design. Designing WCs so there’s a noJS fallback - as you promote, Chris - is a valid choice, it’s just not the only sensible choice.

decompwlj, to mathematics
@decompwlj@mathstodon.xyz avatar
ramsey,
@ramsey@phpc.social avatar

@decompwlj I’m curious in what way was PHP used in creating these graphs?

SocketSecurity, to programming
@SocketSecurity@fosstodon.org avatar

LDAPjs, an LDAP client and server API for Node.js, was decommissioned after its maintainer received an abusive email from a user, raising concerns about this form of abuse as a potential attack vector. https://socket.dev/blog/ldapjs-open-source-project-decommissioned-after-maintainer-receives-abusive-email

  • All
  • Subscribed
  • Moderated
  • Favorites
  • anitta
  • khanakhh
  • mdbf
  • InstantRegret
  • Durango
  • Youngstown
  • rosin
  • slotface
  • thenastyranch
  • osvaldo12
  • ngwrru68w68
  • kavyap
  • cisconetworking
  • DreamBathrooms
  • megavids
  • magazineikmin
  • cubers
  • vwfavf
  • modclub
  • everett
  • ethstaker
  • normalnudes
  • tacticalgear
  • tester
  • provamag3
  • GTA5RPClips
  • Leos
  • JUstTest
  • All magazines