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
import { email } from "https://esm.town/v/std/email?v=12";
const modelName = "lg-v3-x1";
const dictionaryUrl = `https://thesephist--prism-start-app.modal.run/models/${modelName}`;
const confidenceThreshold = 0.8;
function randomlyPickFeature(featuresAboveConfidenceThreshold) {
return featuresAboveConfidenceThreshold[Math.floor(Math.random() * featuresAboveConfidenceThreshold.length)];
}
function getFeatureLink(feature) {
const { index } = feature;
return `https://thesephist--prism-start-app.modal.run/f/${modelName}/${index}?layout=2`;
}
export default async function(interval: Interval) {
const response = await fetch(dictionaryUrl);
const { features } = await response.json();
const featuresAboveConfidenceThreshold = features.filter(
feature => feature.confidence > confidenceThreshold,
);
const randomFeature = randomlyPickFeature(featuresAboveConfidenceThreshold);
console.log(randomFeature);
}