Skip to content

Update codegen to use the latest OpenAPI spec #81

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 7 additions & 31 deletions examples/kitchen-sink.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,8 @@ import {
StableDiffusionXLIPAdapter,
StableDiffusionXLControlNet,
FillMask,
BigLaMa,
UpscaleImage,
RealESRGAN,
RemoveBackground,
DISISNet,
SegmentUnderPoint,
SegmentAnything,
TranscribeMedia,
Expand All @@ -45,7 +42,7 @@ import {
Mixtral8x7BInstruct,
Llama3Instruct8B,
Llama3Instruct70B,
RunCode,
RunPython,
} from "substrate";

const urls = {
Expand Down Expand Up @@ -473,29 +470,6 @@ const examples = [
}),
envs: ALL_ENVS,
},
{
// FIXME: it looks like this should work for v1, but doesn't yet
node: new DISISNet({
image_uri: "https://media.substrate.run/docs-seurat.jpg",
store: "hosted",
}),
envs: [STAGING_V0, PRODUCTION_V1],
},
{
node: new BigLaMa({
image_uri: "https://media.substrate.run/docs-seurat.jpg",
mask_image_uri: "https://media.substrate.run/spiral-logo.jpeg",
// store: "hosted", // FIXME: not working yet
}),
envs: [STAGING_V1, PRODUCTION_V1],
},
{
node: new RealESRGAN({
image_uri: "https://media.substrate.run/docs-seurat.jpg",
// store: "hosted", // FIXME: not working yet
}),
envs: [STAGING_V1, PRODUCTION_V1],
},
{
node: new SegmentAnything({
image_uri: "https://media.substrate.run/docs-vg-bedroom.jpg",
Expand Down Expand Up @@ -535,10 +509,12 @@ const examples = [
envs: [STAGING_V1, PRODUCTION_V1],
},
{
node: new RunCode({
language: "python",
code: `import sys; print(f"hello {sys.argv[1]}")`,
args: ["substrate"],
node: new RunPython({
code: "import numpy as np; print(SB_IN['foo']); SB_OUT['result']=np.sum([1,2]).item()",
input: {
foo: "bar",
},
pip_install: ["numpy"],
}),
envs: [STAGING_V1, PRODUCTION_V1],
},
Expand Down
22 changes: 22 additions & 0 deletions examples/run-python.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/usr/bin/env -S npx ts-node --transpileOnly

import { Substrate, RunPython } from "substrate";

async function main() {
const SUBSTRATE_API_KEY = process.env["SUBSTRATE_API_KEY"];

const substrate = new Substrate({ apiKey: SUBSTRATE_API_KEY });

const node = new RunPython({
code: "import numpy as np; print(SB_IN['foo']); SB_OUT['result']=np.sum([1,2]).item()",
input: {
foo: "bar",
},
pip_install: ["numpy"],
});

const res = await substrate.run(node);

console.log(res.get(node));
}
main();
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "substrate",
"version": "120240418.0.13",
"version": "120240530.0.13",
"description": "The official SDK for the Substrate API",
"repository": {
"type": "git",
Expand Down
2 changes: 1 addition & 1 deletion src/GEN_VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
20240418.20240430
20240530.20240531
Loading
Loading