//native
type Deepinfra = {
token: string;
};
/**
* Model Meta Update
*
*/
export async function main(
auth: Deepinfra,
model_name: string,
body: {
description?: string;
github_url?: string;
paper_url?: string;
license_url?: string;
readme?: string;
cover_img_url?: string;
reported_type?:
| "automatic-speech-recognition"
| "image-classification"
| "question-answering"
| "token-classification"
| "text-to-image"
| "fill-mask"
| "zero-shot-image-classification"
| "text2text-generation"
| "text-generation"
| "text-classification"
| "object-detection"
| "embeddings"
| "dreambooth"
| "custom"
| "text-to-speech"
| "text-to-video";
},
) {
const url = new URL(`https://api.deepinfra.com/models/${model_name}/meta`);
const response = await fetch(url, {
method: "POST",
headers: {
"Content-Type": "application/json",
Authorization: "Bearer " + auth.token,
},
body: JSON.stringify(body),
});
if (!response.ok) {
const text = await response.text();
throw new Error(`${response.status} ${text}`);
}
return await response.json();
}
Submitted by hugo697 235 days ago