npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

inference-client

v0.0.7

Published

Jina Inference Client for JavaScript

Downloads

3

Readme

Inference Client JS

Installation

$ npm install inference-client

Initialization

import Client from 'inference-client';

const client = new Client('Your Jina AI Auth Token');

Caption

const model = await client.getModel('Salesforce/blip2-flan-t5-xl');

const c = await model.caption({ image: 'https://picsum.photos/200' });
// OR
const c = await model.caption({ image: 'path/to/local/image' });

console.log(c);

Encode

const model = await client.getModel('ViT-H-14::laion2b-s32b-b79k');

const e = await model.encode({ text: 'hello world' });
// OR
const e = await model.encode({ image: 'https://picsum.photos/200' });
// OR
const e = await model.encode({ image: 'path/to/local/image' });

console.log(e);

Rank

const model = await client.getModel('ViT-H-14::laion2b-s32b-b79k');

const r = await model.rank({ text: 'hello world', text_candidates: ['hello Jina', 'hello Ziniu'] });
// OR
const r = await model.rank({
    text: 'green field and blue sky',
    image_candidates: ['https://picsum.photos/id/254/200', 'https://picsum.photos/id/255/200'],
});
// OR
const r = await model.rank({
    image: 'https://picsum.photos/id/254/200',
    text_candidates: ['green field and blue sky', 'black trees'],
});
// OR
const r = await model.rank({
    image: 'https://picsum.photos/id/251/200',
    image_candidates: ['https://picsum.photos/id/254/200', 'https://picsum.photos/id/255/200'],
});

console.log(r);

Upscale

const model = await client.getModel('LapSRN_x2');

const u = await model.upscale({ image: 'https://picsum.photos/id/251/200' });
// OR
const u = await model.upscale({ image: 'https://picsum.photos/id/251/200', scale: '600:800' });
// OR
const u = await model.upscale({ image: 'https://picsum.photos/id/251/200', image_format: 'jpeg' });
// OR
const u = await model.upscale({ image: 'https://picsum.photos/id/251/200', quality: 80 });

console.log(u);

VQA

const model = await client.getModel('Salesforce/blip2-flan-t5-xl');

const v = await model.vqa({
    image: 'https://picsum.photos/200',
    question: 'Qustion: what are the main colors of this image? Answer:',
});
// OR
const v = await model.vqa({
    image: 'path/to/local/image',
    question: 'Qustion: what are the main colors of this image? Answer:',
});

console.log(v);