Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
machineuser
commited on
Commit
·
9abd9af
1
Parent(s):
8ef5d3c
Sync widgets demo
Browse files
packages/inference/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
{
|
| 2 |
"name": "@huggingface/inference",
|
| 3 |
-
"version": "2.6.
|
| 4 |
"packageManager": "[email protected]",
|
| 5 |
"license": "MIT",
|
| 6 |
"author": "Tim Mikeladze <[email protected]>",
|
|
|
|
| 1 |
{
|
| 2 |
"name": "@huggingface/inference",
|
| 3 |
+
"version": "2.6.7",
|
| 4 |
"packageManager": "[email protected]",
|
| 5 |
"license": "MIT",
|
| 6 |
"author": "Tim Mikeladze <[email protected]>",
|
packages/inference/src/lib/makeRequestOptions.ts
CHANGED
|
@@ -89,19 +89,14 @@ export async function makeRequestOptions(
|
|
| 89 |
return `${HF_INFERENCE_API_BASE_URL}/models/${model}`;
|
| 90 |
})();
|
| 91 |
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
// So in order to make this backwards compatible, if it's undefined we go to "same-origin" (default behaviour before).
|
| 96 |
-
// If it's a boolean and set to true then set to "include". If false, don't define credentials at all (useful for edge runtimes)
|
| 97 |
-
// Then finally, if it's a string, use it as-is.
|
| 98 |
let credentials: RequestCredentials | undefined;
|
| 99 |
if (typeof includeCredentials === "string") {
|
| 100 |
credentials = includeCredentials as RequestCredentials;
|
| 101 |
-
} else if (
|
| 102 |
-
credentials =
|
| 103 |
-
} else if (includeCredentials === undefined) {
|
| 104 |
-
credentials = "same-origin";
|
| 105 |
}
|
| 106 |
|
| 107 |
const info: RequestInit = {
|
|
@@ -113,7 +108,7 @@ export async function makeRequestOptions(
|
|
| 113 |
...otherArgs,
|
| 114 |
options: options && otherOptions,
|
| 115 |
}),
|
| 116 |
-
credentials,
|
| 117 |
signal: options?.signal,
|
| 118 |
};
|
| 119 |
|
|
|
|
| 89 |
return `${HF_INFERENCE_API_BASE_URL}/models/${model}`;
|
| 90 |
})();
|
| 91 |
|
| 92 |
+
/**
|
| 93 |
+
* For edge runtimes, leave 'credentials' undefined, otherwise cloudflare workers will error
|
| 94 |
+
*/
|
|
|
|
|
|
|
|
|
|
| 95 |
let credentials: RequestCredentials | undefined;
|
| 96 |
if (typeof includeCredentials === "string") {
|
| 97 |
credentials = includeCredentials as RequestCredentials;
|
| 98 |
+
} else if (includeCredentials === true) {
|
| 99 |
+
credentials = "include";
|
|
|
|
|
|
|
| 100 |
}
|
| 101 |
|
| 102 |
const info: RequestInit = {
|
|
|
|
| 108 |
...otherArgs,
|
| 109 |
options: options && otherOptions,
|
| 110 |
}),
|
| 111 |
+
...(credentials && { credentials }),
|
| 112 |
signal: options?.signal,
|
| 113 |
};
|
| 114 |
|
packages/inference/src/types.ts
CHANGED
|
@@ -32,7 +32,7 @@ export interface Options {
|
|
| 32 |
signal?: AbortSignal;
|
| 33 |
|
| 34 |
/**
|
| 35 |
-
*
|
| 36 |
*/
|
| 37 |
includeCredentials?: string | boolean;
|
| 38 |
}
|
|
|
|
| 32 |
signal?: AbortSignal;
|
| 33 |
|
| 34 |
/**
|
| 35 |
+
* Credentials to use for the request. If this is a string, it will be passed straight on. If it's a boolean, true will be "include" and false will not send credentials at all (which defaults to "same-origin" inside browsers).
|
| 36 |
*/
|
| 37 |
includeCredentials?: string | boolean;
|
| 38 |
}
|
packages/tasks/src/model-libraries-snippets.ts
CHANGED
|
@@ -531,6 +531,12 @@ IWorker engine = WorkerFactory.CreateWorker(BackendType.GPUCompute, model);
|
|
| 531 |
`,
|
| 532 |
];
|
| 533 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 534 |
export const mlx = (model: ModelData): string[] => [
|
| 535 |
`pip install huggingface_hub hf_transfer
|
| 536 |
|
|
|
|
| 531 |
`,
|
| 532 |
];
|
| 533 |
|
| 534 |
+
export const voicecraft = (model: ModelData): string[] => [
|
| 535 |
+
`from voicecraft import VoiceCraftHF
|
| 536 |
+
|
| 537 |
+
model = VoiceCraftHF.from_pretrained("${model.id}")`,
|
| 538 |
+
];
|
| 539 |
+
|
| 540 |
export const mlx = (model: ModelData): string[] => [
|
| 541 |
`pip install huggingface_hub hf_transfer
|
| 542 |
|
packages/tasks/src/model-libraries.ts
CHANGED
|
@@ -407,6 +407,13 @@ export const MODEL_LIBRARIES_UI_ELEMENTS = {
|
|
| 407 |
wildcard: { path: "*.sentis" },
|
| 408 |
},
|
| 409 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 410 |
whisperkit: {
|
| 411 |
prettyLabel: "WhisperKit",
|
| 412 |
repoName: "WhisperKit",
|
|
|
|
| 407 |
wildcard: { path: "*.sentis" },
|
| 408 |
},
|
| 409 |
},
|
| 410 |
+
voicecraft: {
|
| 411 |
+
prettyLabel: "VoiceCraft",
|
| 412 |
+
repoName: "VoiceCraft",
|
| 413 |
+
repoUrl: "https://github.com/jasonppy/VoiceCraft",
|
| 414 |
+
docsUrl: "https://github.com/jasonppy/VoiceCraft",
|
| 415 |
+
snippets: snippets.voicecraft,
|
| 416 |
+
},
|
| 417 |
whisperkit: {
|
| 418 |
prettyLabel: "WhisperKit",
|
| 419 |
repoName: "WhisperKit",
|