Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
export async function load({ url, fetch }) { | |
let model_parameter = url.searchParams.get("model") | |
let model = null; | |
if (model_parameter) { | |
model_parameter = model_parameter?.replace("/", "@") | |
const model_request = await fetch(`/api/models/${model_parameter}`, { | |
method: "GET", | |
headers: { | |
"Content-Type": "application/json" | |
} | |
}) | |
model = await model_request.json() | |
} | |
const models_request = await fetch("/api/models?page=0&filter=likes&limit=5", { | |
method: "GET", | |
headers: { | |
"Content-Type": "application/json" | |
} | |
}) | |
const models = await models_request.json() | |
return { | |
model: model?.model, | |
models | |
} | |
} |