-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathbedrock.w
35 lines (29 loc) · 889 Bytes
/
bedrock.w
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
bring aws;
bring util;
bring "./api.w" as a;
bring "./bedrock.sim.w" as s;
bring "./bedrock.tfaws.w" as t;
pub class Model impl a.IModel {
pub modelId: str;
inner: a.IModel;
new(modelId: str) {
this.modelId = modelId;
let target = util.env("WING_TARGET");
if target == "sim" {
if nodeof(this).app.isTestEnvironment {
// in case of test running on sim, use simulator version
this.inner = new s.Model_sim(modelId) as "sim";
} else {
// in case of running on sim interactively (in development mode), use AWS version
this.inner = new t.Model_tfaws(modelId) as "tf-aws";
}
} else if target == "tf-aws" {
this.inner = new t.Model_tfaws(modelId) as "tf-aws";
} else {
throw "Unsupported target {target}";
}
}
pub inflight invoke(body: Json): Json {
return this.inner.invoke(body);
}
}