8 | {output} 9 |
10 | {/if} 11 | -------------------------------------------------------------------------------- /packages/tasks/src/tasks/translation/spec/input.json: -------------------------------------------------------------------------------- 1 | { 2 | "$ref": "/inference/schemas/text2text-generation/input.json", 3 | "$id": "/inference/schemas/translation/input.json", 4 | "$schema": "http://json-schema.org/draft-06/schema#", 5 | "title": "TranslationInput", 6 | "description": "Inputs for Translation inference" 7 | } 8 | -------------------------------------------------------------------------------- /packages/tasks/src/tasks/text-to-speech/spec/input.json: -------------------------------------------------------------------------------- 1 | { 2 | "$ref": "/inference/schemas/text-to-audio/input.json", 3 | "$id": "/inference/schemas/text-to-speech/input.json", 4 | "$schema": "http://json-schema.org/draft-06/schema#", 5 | "title": "TextToSpeechInput", 6 | "description": "Inputs for Text to Speech inference" 7 | } 8 | -------------------------------------------------------------------------------- /packages/tasks/src/tasks/summarization/spec/input.json: -------------------------------------------------------------------------------- 1 | { 2 | "$ref": "/inference/schemas/text2text-generation/input.json", 3 | "$id": "/inference/schemas/summarization/input.json", 4 | "$schema": "http://json-schema.org/draft-06/schema#", 5 | "title": "SummarizationInput", 6 | "description": "Inputs for Summarization inference" 7 | } 8 | -------------------------------------------------------------------------------- /packages/tasks/src/tasks/text-to-speech/spec/output.json: -------------------------------------------------------------------------------- 1 | { 2 | "$ref": "/inference/schemas/text-to-audio/output.json", 3 | "$id": "/inference/schemas/text-to-speech/output.json", 4 | "$schema": "http://json-schema.org/draft-06/schema#", 5 | "title": "TextToSpeechOutput", 6 | "description": "Outputs for Text to Speech inference" 7 | } 8 | -------------------------------------------------------------------------------- /packages/tasks/src/tasks/feature-extraction/spec/output.json: -------------------------------------------------------------------------------- 1 | { 2 | "$id": "/inference/schemas/feature-extraction/output.json", 3 | "$schema": "http://json-schema.org/draft-06/schema#", 4 | "description": "The embedding for the input text, as a nested list (tensor) of floats", 5 | "type": "array", 6 | "title": "FeatureExtractionOutput" 7 | } 8 | -------------------------------------------------------------------------------- /packages/inference/src/lib/InferenceOutputError.ts: -------------------------------------------------------------------------------- 1 | export class InferenceOutputError extends TypeError { 2 | constructor(message: string) { 3 | super( 4 | `Invalid inference output: ${message}. Use the 'request' method with the same parameters to do a custom call with no type checking.` 5 | ); 6 | this.name = "InferenceOutputError"; 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /e2e/ts/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ES2015", 4 | "module": "commonjs", 5 | "strict": true, 6 | "esModuleInterop": true, 7 | "skipLibCheck": true, 8 | "forceConsistentCasingInFileNames": true, 9 | "outDir": "dist" 10 | }, 11 | "$schema": "https://json.schemastore.org/tsconfig", 12 | "display": "Recommended" 13 | } 14 | -------------------------------------------------------------------------------- /packages/shared/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "esModuleInterop": true, 4 | "noEmit": false, 5 | "module": "ESNext", 6 | "target": "ESNext", 7 | "moduleResolution": "Node", 8 | "noImplicitAny": true, 9 | "strict": true, 10 | "strictNullChecks": true, 11 | "skipLibCheck": true, 12 | "composite": true 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /packages/hub/src/utils/hexFromBytes.ts: -------------------------------------------------------------------------------- 1 | export function hexFromBytes(arr: Uint8Array): string { 2 | if (globalThis.Buffer) { 3 | return globalThis.Buffer.from(arr).toString("hex"); 4 | } else { 5 | const bin: string[] = []; 6 | arr.forEach((byte) => { 7 | bin.push(byte.toString(16).padStart(2, "0")); 8 | }); 9 | return bin.join(""); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /packages/shared/src/base64FromBytes.ts: -------------------------------------------------------------------------------- 1 | export function base64FromBytes(arr: Uint8Array): string { 2 | if (globalThis.Buffer) { 3 | return globalThis.Buffer.from(arr).toString("base64"); 4 | } else { 5 | const bin: string[] = []; 6 | arr.forEach((byte) => { 7 | bin.push(String.fromCharCode(byte)); 8 | }); 9 | return globalThis.btoa(bin.join("")); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /packages/hub/src/utils/pick.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Return copy of object, only keeping whitelisted properties. 3 | */ 4 | export function pick{data.model.id}
16 |
17 |
23 | {JSON.stringify(data.model, null, 2)}
24 |
25 | {:else}
26 | Visit kit.svelte.dev to read the documentation
32 | -------------------------------------------------------------------------------- /packages/hub/src/lib/file-exists.ts: -------------------------------------------------------------------------------- 1 | import { HUB_URL } from "../consts"; 2 | import { createApiError } from "../error"; 3 | import type { Credentials, RepoDesignation } from "../types/public"; 4 | import { checkCredentials } from "../utils/checkCredentials"; 5 | import { toRepoId } from "../utils/toRepoId"; 6 | 7 | export async function fileExists(params: { 8 | repo: RepoDesignation; 9 | path: string; 10 | revision?: string; 11 | credentials?: Credentials; 12 | hubUrl?: string; 13 | /** 14 | * Custom fetch function to use instead of the default one, for example to use a proxy or edit headers. 15 | */ 16 | fetch?: typeof fetch; 17 | }): Promise