Huggingface.js documentation

🤗 Encabezado del espacio de Hugging Face

Hugging Face's logo
Join the Hugging Face community

and get access to the augmented documentation experience

to get started

🤗 Encabezado del espacio de Hugging Face

Un wrapper con tecnología Typescript para la función mini_header de Space.

space header preview

Instalación

pnpm add @huggingface/space-header

npm add @huggingface/space-header

yarn add @huggingface/space-header

Deno

// esm.sh
import { init } from "https://esm.sh/@huggingface/space-header"
// or npm:
import { init } from "npm:@huggingface/space-header"

Inicializar

import { init } from "@huggingface/space-header";

// ...

init(":user/:spaceId");
// init("enzostvs/lora-studio") for example

❗Nota importante: el método init debe llamarse en el lado del cliente.

Uso

Utiliza la opción target para inyectar el encabezado de espacio en otro elemento del DOM

const app = document.getElementById("app");

// ...

init(":user/:spaceId", {
  target: app
});

Si ya tienes los datos del espacio, también puedes pasarlos como parámetro para evitar una solicitud

init(space);

// space = {
//  id: string;
//  likes: number;
//  author: string;
// }
Update on GitHub