Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@huggingface/inference

Package Overview
Dependencies
Maintainers
3
Versions
46
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@huggingface/inference - npm Package Compare versions

Comparing version 2.2.0 to 2.2.1

./dist/index.js

19

dist/index.js

@@ -41,2 +41,3 @@ "use strict";

tableQuestionAnswering: () => tableQuestionAnswering,
tabularRegression: () => tabularRegression,
textClassification: () => textClassification,

@@ -73,2 +74,3 @@ textGeneration: () => textGeneration,

tableQuestionAnswering: () => tableQuestionAnswering,
tabularRegression: () => tabularRegression,
textClassification: () => textClassification,

@@ -564,3 +566,3 @@ textGeneration: () => textGeneration,

// src/utils/base64FromBytes.ts
// ../shared/src/base64FromBytes.ts
function base64FromBytes(arr) {

@@ -578,2 +580,6 @@ if (globalThis.Buffer) {

// ../shared/src/isBackend.ts
var isBrowser = typeof window !== "undefined" && typeof window.document !== "undefined";
var isWebWorker = typeof self === "object" && self.constructor && self.constructor.name === "DedicatedWorkerGlobalScope";
// src/tasks/multimodal/documentQuestionAnswering.ts

@@ -617,2 +623,12 @@ async function documentQuestionAnswering(args, options) {

// src/tasks/tabular/tabularRegression.ts
async function tabularRegression(args, options) {
const res = await request(args, options);
const isValidOutput = Array.isArray(res) && res.every((x) => typeof x === "number");
if (!isValidOutput) {
throw new InferenceOutputError("Expected number[]");
}
return res;
}
// src/HfInference.ts

@@ -677,2 +693,3 @@ var HfInference = class {

tableQuestionAnswering,
tabularRegression,
textClassification,

@@ -679,0 +696,0 @@ textGeneration,

9

package.json
{
"name": "@huggingface/inference",
"version": "2.2.0",
"version": "2.2.1",
"license": "MIT",

@@ -43,4 +43,8 @@ "author": "Tim Mikeladze <tim.mikeladze@gmail.com>",

"vite": "^4.1.4",
"vitest": "^0.29.8"
"vitest": "^0.29.8",
"@huggingface/shared": "1.0.0"
},
"bundledDependencies": [
"@huggingface/shared"
],
"resolutions": {},

@@ -53,2 +57,3 @@ "scripts": {

"format:check": "prettier --check .",
"preversion": "pnpm --filter doc-internal run fix-cdn-versions && git add ../../README.md",
"test": "vitest run --config vitest.config.ts",

@@ -55,0 +60,0 @@ "test:browser": "vitest run --browser.name=chrome --browser.headless --config vitest.config.ts",

@@ -191,2 +191,18 @@ # 🤗 Hugging Face Inference API

// Tabular
await hf.tabularRegression({
model: "scikit-learn/Fish-Weight",
inputs: {
data: {
"Height":["11.52", "12.48", "12.3778"],
"Length1":["23.2", "24", "23.9"],
"Length2":["25.4", "26.3", "26.5"],
"Length3":["30", "31.2", "31.1"],
"Species":["Bream", "Bream", "Bream"],
"Width":["4.02", "4.3056", "4.6961"]
},
},
})
// Custom call, for models with custom parameters / outputs

@@ -226,3 +242,3 @@ await hf.request({

- [x] Text classification
- [x] Text generation
- [x] Text generation - [demo](https://huggingface.co/spaces/huggingfacejs/streaming-text-generation)
- [x] Text2Text generation

@@ -248,8 +264,11 @@ - [x] Token classification

- [x] Text to image
- [x] Image to text
- [x] Image to text - [demo](https://huggingface.co/spaces/huggingfacejs/image-to-text)
### Multimodal
- [x] Document question answering
- [x] Visual question answering
- [x] Document question answering - [demo](https://huggingface.co/spaces/huggingfacejs/doc-vis-qa)
- [x] Visual question answering - [demo](https://huggingface.co/spaces/huggingfacejs/doc-vis-qa)
### Tabular
- [x] Tabular regression
## Tree-shaking

@@ -256,0 +275,0 @@

@@ -10,3 +10,3 @@ // Custom tasks with arbitrary inputs and outputs

// Commputer Vision tasks
// Computer Vision tasks
export * from "./cv/imageClassification";

@@ -36,1 +36,4 @@ export * from "./cv/imageSegmentation";

export * from "./multimodal/visualQuestionAnswering";
// Tabular tasks
export * from "./tabular/tabularRegression";

@@ -5,3 +5,3 @@ import { InferenceOutputError } from "../../lib/InferenceOutputError";

import type { RequestArgs } from "../../types";
import { base64FromBytes } from "../../utils/base64FromBytes";
import { base64FromBytes } from "@huggingface/shared";
import { toArray } from "../../utils/toArray";

@@ -8,0 +8,0 @@

import { InferenceOutputError } from "../../lib/InferenceOutputError";
import type { BaseArgs, Options, RequestArgs } from "../../types";
import { request } from "../custom/request";
import { base64FromBytes } from "../../utils/base64FromBytes";
import { base64FromBytes } from "@huggingface/shared";

@@ -6,0 +6,0 @@ export type VisualQuestionAnsweringArgs = BaseArgs & {

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc