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/

ovid, to Lisp
@ovid@fosstodon.org avatar

, , and are three powerful programming languages that share a common feature.

Nobody knows how the hell to capitalize them.

ovid,
@ovid@fosstodon.org avatar

@tripleo I always have to look up the capitalization of Smalltalk because I get it wrong every time.

Hmm ... #JavaScript should be in that list.

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/

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 😩

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.

decompwlj, to mathematics
@decompwlj@mathstodon.xyz avatar
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

davidbisset, to javascript
@davidbisset@phpc.social avatar

A long list of (advanced) questions, and their explanation (created in 2019).

https://github.com/lydiahallie/javascript-questions

YurkshireLad, to javascript
@YurkshireLad@mastodon.social avatar

These questions/answers make me glad I'm not working with anymore!

"lydiahallie/javascript-questions: A long list of (advanced) JavaScript questions, and their explanations"

https://github.com/lydiahallie/javascript-questions

masukomi, to javascript
@masukomi@connectified.com avatar

#JavaScript Geeks:

🤔 I really want to figure out how to make #FediThready be able to post to a Mastodon server WITHOUT requiring a back-end.

I'm pretty sure it's possible to do OAuth and store the token locally without one, but i would love it if someone could point me to an example of this rather than figuring it out from first principles.

leanpub, to Java
@leanpub@mastodon.social avatar

Modern Thymeleaf Bundle https://leanpub.com/b/modern-thymeleaf-bundle by Wim Deblauwe is the featured bundle on the Leanpub homepage! https://leanpub.com wimdeblauwe@mastodon.social

domhabersack, to javascript
@domhabersack@mastodon.social avatar

You can turn off the “x packages are looking for funding” messages that get logged with each npm install by setting

fund = false

in your project’s or user’s npmrc file.

https://domhabersack.com/blog/npm-fund-false

#javascript

premartinpatrick, to Twitch French
@premartinpatrick@mastouille.fr avatar

On s'occupe de la partie serveur du site de loterie à partir de 10h30 sur ma chaîne . Codage en maintenant que la partie / et est bouclée.

RDV sur https://www.twitch.tv/patrickpremartin pour y assister.

Hier j'ai fait un peu de , ce ne fut pas si laborieux que ça. Voici comment seront choisis les numéros de ticket de loterie par les participants : https://youtu.be/vdTp7XzNmBE

janl, to random
@janl@narrativ.es avatar

Funny, in it is unnerving to use a library version that has not had a release in four days. https://social.vivaldi.net/@Patricia/112447339260051370

eldamir, to javascript
@eldamir@hachyderm.io avatar

How to check and make sure that a data is null in ?

davidbisset, to javascript
@davidbisset@phpc.social avatar

Five Basic Things About That Will Help Non JavaScript-Focused Web
https://frontendmasters.com/blog/5-things-designers-can-do-with-javascript/

  • 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