File size: 1,117 Bytes
5e47e93 | 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 35 36 37 38 39 40 41 42 43 44 | async function runSigil() {
const input = document.getElementById("inputBox").value;
setStatus("probing API...");
const endpoints = [
"/run/run_predictive",
"/api/predict",
"/run/predict"
];
for (let ep of endpoints) {
try {
const url = "https://nine1eight-vil-glyphmatic-demo.hf.space" + ep;
const res = await fetch(url, {
method: "POST",
headers: {"Content-Type": "application/json"},
body: JSON.stringify({
data: [input, "web"],
user_input: input,
session_id: "web"
})
});
if (!res.ok) throw new Error("HTTP " + res.status);
const json = await res.json();
console.log("SUCCESS endpoint:", ep, json);
const data = json.data || json;
updateUI(data);
setStatus("success → " + ep);
return;
} catch (e) {
console.warn("failed:", ep);
}
}
setStatus("ALL ENDPOINTS FAILED");
}
|