0.0.16 • Published 7 months ago

dscimg v0.0.16

Weekly downloads
-
License
The Unlicense
Repository
-
Last release
7 months ago

dscimg

npm.io

CLI program that uses takes in image filepaths, and uses Cloudflare Workers AI to rename them to a natural-language description.

npm.io

Context

I am a simple man. I right click, save as, and then I keep 23nr129fn1u49fn1_BIG.jpeg on my desktop forever, afraid of what it may contain. Today, using cutting-edge technology, we can ask a robot what images we downloaded, and it will respond with a wholly incorrect answer.

Installation

If you don't have the following configuration variables set, the program (should) prompt you to enter them. If that doesn't work, run: dscimg config.

You'll need two Cloudflare-centric information tidbits to kickstart your journey:

  • cloudflareAPIToken: - Your Cloudflare API token with cf workers ai enabled in scope.
  • cloudflareEndpoint: - A cloudflare AI Gateway URL for the correct image-to-text model; this model being either llava-hf/llava-1.5-7b-hf or uform-gen2-qwen-500m as of June '24. This endpoint should look something like this: https://gateway.ai.cloudflare.com/v1/<some secret shit>/<more secret shit>/workers-ai/@cf/llava-hf/llava-1.5-7b-hf.

Usage

dscimg "/home/dad/Pictures/unknown-pictures"

Takes in folders, files, and probably globs. Filters out the non-images. Will (probably) not overwrite your files. But, if you're scared, pass it the -d (dry run) arg.

Example Output:

Renamed test.jpg to man-wearing-a-green-shirt-with-a-watermelon-on-his-face.jpg (764ms)

Trailing numerals are length of server "thinking" time. I was just curious.

Money, money, money

Cloudflare Workers does its pricing in "Neurons" to make it more of a pain in the ass to understand.My back-of-the-napkin math indicates that each request to llava-hf/llava-1.5-7b-hf is about .32 neurons. So, in theory, you get 31,250 requests per day. Cool.

0.0.16

7 months ago

0.0.15

7 months ago

0.0.12

8 months ago

0.0.13

8 months ago

0.0.14

8 months ago

0.0.11

9 months ago

0.0.10

10 months ago

0.0.9

10 months ago

0.0.8

11 months ago

0.0.7

11 months ago

0.0.6

11 months ago

0.0.3

12 months ago

0.0.2

1 year ago

0.0.5

12 months ago

0.0.4

12 months ago

0.0.1

1 year ago