@huggingface/tasks 0.12.6 → 0.12.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +2 -2
- package/dist/index.js +2 -2
- package/package.json +1 -1
- package/src/model-libraries-snippets.ts +2 -2
package/dist/index.cjs
CHANGED
|
@@ -4390,7 +4390,7 @@ function nameWithoutNamespace(modelId) {
|
|
|
4390
4390
|
const splitted = modelId.split("/");
|
|
4391
4391
|
return splitted.length === 1 ? splitted[0] : splitted[1];
|
|
4392
4392
|
}
|
|
4393
|
-
var escapeStringForJson = (str) => JSON.stringify(str);
|
|
4393
|
+
var escapeStringForJson = (str) => JSON.stringify(str).slice(1, -1);
|
|
4394
4394
|
var adapters = (model) => [
|
|
4395
4395
|
`from adapters import AutoAdapterModel
|
|
4396
4396
|
|
|
@@ -4444,7 +4444,7 @@ function get_base_diffusers_model(model) {
|
|
|
4444
4444
|
return model.cardData?.base_model?.toString() ?? "fill-in-base-model";
|
|
4445
4445
|
}
|
|
4446
4446
|
function get_prompt_from_diffusers_model(model) {
|
|
4447
|
-
const prompt =
|
|
4447
|
+
const prompt = model.widgetData?.[0]?.text ?? model.cardData?.instance_prompt;
|
|
4448
4448
|
if (prompt) {
|
|
4449
4449
|
return escapeStringForJson(prompt);
|
|
4450
4450
|
}
|
package/dist/index.js
CHANGED
|
@@ -4352,7 +4352,7 @@ function nameWithoutNamespace(modelId) {
|
|
|
4352
4352
|
const splitted = modelId.split("/");
|
|
4353
4353
|
return splitted.length === 1 ? splitted[0] : splitted[1];
|
|
4354
4354
|
}
|
|
4355
|
-
var escapeStringForJson = (str) => JSON.stringify(str);
|
|
4355
|
+
var escapeStringForJson = (str) => JSON.stringify(str).slice(1, -1);
|
|
4356
4356
|
var adapters = (model) => [
|
|
4357
4357
|
`from adapters import AutoAdapterModel
|
|
4358
4358
|
|
|
@@ -4406,7 +4406,7 @@ function get_base_diffusers_model(model) {
|
|
|
4406
4406
|
return model.cardData?.base_model?.toString() ?? "fill-in-base-model";
|
|
4407
4407
|
}
|
|
4408
4408
|
function get_prompt_from_diffusers_model(model) {
|
|
4409
|
-
const prompt =
|
|
4409
|
+
const prompt = model.widgetData?.[0]?.text ?? model.cardData?.instance_prompt;
|
|
4410
4410
|
if (prompt) {
|
|
4411
4411
|
return escapeStringForJson(prompt);
|
|
4412
4412
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@huggingface/tasks",
|
|
3
3
|
"packageManager": "pnpm@8.10.5",
|
|
4
|
-
"version": "0.12.
|
|
4
|
+
"version": "0.12.8",
|
|
5
5
|
"description": "List of ML tasks for huggingface.co/tasks",
|
|
6
6
|
"repository": "https://github.com/huggingface/huggingface.js.git",
|
|
7
7
|
"publishConfig": {
|
|
@@ -9,7 +9,7 @@ function nameWithoutNamespace(modelId: string): string {
|
|
|
9
9
|
return splitted.length === 1 ? splitted[0] : splitted[1];
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
const escapeStringForJson = (str: string): string => JSON.stringify(str);
|
|
12
|
+
const escapeStringForJson = (str: string): string => JSON.stringify(str).slice(1, -1); // slice is needed to remove surrounding quotes added by JSON.stringify
|
|
13
13
|
|
|
14
14
|
//#region snippets
|
|
15
15
|
|
|
@@ -74,7 +74,7 @@ function get_base_diffusers_model(model: ModelData): string {
|
|
|
74
74
|
}
|
|
75
75
|
|
|
76
76
|
function get_prompt_from_diffusers_model(model: ModelData): string | undefined {
|
|
77
|
-
const prompt = (model.widgetData?.[0] as WidgetExampleTextInput)
|
|
77
|
+
const prompt = (model.widgetData?.[0] as WidgetExampleTextInput | undefined)?.text ?? model.cardData?.instance_prompt;
|
|
78
78
|
if (prompt) {
|
|
79
79
|
return escapeStringForJson(prompt);
|
|
80
80
|
}
|