Skip to content

Commit e886539

Browse files
committed
Formatting
1 parent 747629f commit e886539

File tree

2 files changed

+18
-11
lines changed

2 files changed

+18
-11
lines changed

lib/deployments.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ const { transformFileInputs } = require("./util");
1313
* @returns {Promise<object>} Resolves with the created prediction data
1414
*/
1515
async function createPrediction(deployment_owner, deployment_name, options) {
16-
const { stream, input: _input, ...data } = options;
16+
const { stream, input, ...data } = options;
1717

1818
if (data.webhook) {
1919
try {
@@ -24,14 +24,15 @@ async function createPrediction(deployment_owner, deployment_name, options) {
2424
}
2525
}
2626

27-
// Transform any file looking fields into strings (either data uri or urls).
28-
const input = await transformFileInputs(_input);
29-
3027
const response = await this.request(
3128
`/deployments/${deployment_owner}/${deployment_name}/predictions`,
3229
{
3330
method: "POST",
34-
data: { ...data, input, stream },
31+
data: {
32+
...data,
33+
input: await transformFileInputs(input),
34+
stream,
35+
},
3536
}
3637
);
3738

lib/predictions.js

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ const { transformFileInputs } = require("./util");
1313
* @returns {Promise<object>} Resolves with the created prediction
1414
*/
1515
async function createPrediction(options) {
16-
const { model, version, stream, input: _input, ...data } = options;
16+
const { model, version, stream, input, ...data } = options;
1717

1818
if (data.webhook) {
1919
try {
@@ -24,19 +24,25 @@ async function createPrediction(options) {
2424
}
2525
}
2626

27-
// Transform any file looking fields into strings (either data uri or urls).
28-
const input = await transformFileInputs(_input);
29-
3027
let response;
3128
if (version) {
3229
response = await this.request("/predictions", {
3330
method: "POST",
34-
data: { ...data, stream, input, version },
31+
data: {
32+
...data,
33+
input: await transformFileInputs(input),
34+
version,
35+
stream,
36+
},
3537
});
3638
} else if (model) {
3739
response = await this.request(`/models/${model}/predictions`, {
3840
method: "POST",
39-
data: { ...data, stream, input },
41+
data: {
42+
...data,
43+
input: await transformFileInputs(input),
44+
stream,
45+
},
4046
});
4147
} else {
4248
throw new Error("Either model or version must be specified");

0 commit comments

Comments
 (0)