Skip to content

Commit 11d4d47

Browse files
committed
Remove defaulting for js examples.
1 parent 786ad9a commit 11d4d47

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

examples/javascript/tasks/summarization/summarization.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ const model = client.model("ainize/bart-base-cnn");
1616

1717
await model.load();
1818

19-
const { output: [{ summary_text } = {}] = [] } = await model.run(inputText, {
19+
const { output: [{ summary_text }] } = await model.run(inputText, {
2020
max_length: 40
2121
});
2222

examples/javascript/tasks/textToTextGeneration/textToTextGeneration.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ const model = client.model("google/flan-t5-base");
88

99
await model.load();
1010

11-
const { output: [{ generated_text } = {}] = [] } = await model.run(
11+
const { output: [{ generated_text }] } = await model.run(
1212
"Once upon a time there was a small little man who",
1313
modelParams
1414
);

examples/javascript/tasks/translation/translation.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@ const model = client.model("Helsinki-NLP/opus-mt-en-zh");
88

99
await model.load();
1010

11-
const { output: [{ translation_text } = {}] = [] } = await model.run(inputText);
11+
const { output: [{ translation_text }] } = await model.run(inputText);
1212

1313
console.log(translation_text);

javascript/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -596,7 +596,7 @@ const model = client.model("ainize/bart-base-cnn");
596596

597597
await model.load();
598598

599-
const { output: [{ summary_text } = {}] = [] } = await model.run(inputText, {
599+
const { output: [{ summary_text }] } = await model.run(inputText, {
600600
max_length: 40
601601
});
602602

@@ -669,7 +669,7 @@ const model = client.model("Helsinki-NLP/opus-mt-en-zh");
669669

670670
await model.load();
671671

672-
const { output: [{ translation_text } = {}] = [] } = await model.run(inputText);
672+
const { output: [{ translation_text }]} = await model.run(inputText);
673673

674674
console.log(translation_text);
675675
```
@@ -1045,7 +1045,7 @@ const model = client.model("google/flan-t5-base");
10451045

10461046
await model.load();
10471047

1048-
const { output: [{ generated_text } = {}] = [] } = await model.run(
1048+
const { output: [{ generated_text }] } = await model.run(
10491049
"Once upon a time there was a small little man who",
10501050
modelParams
10511051
);

0 commit comments

Comments
 (0)