Huggingface.js documentation

🤗 Hugging Face Space 헤더

Hugging Face's logo
Join the Hugging Face community

and get access to the augmented documentation experience

to get started

🤗 Hugging Face Space 헤더

Space의 mini_header 기능을 위한 Typescript 기반 래퍼입니다.

space header preview

설치

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"

초기화

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

// ...

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

❗중요한 참고: init 메서드는 클라이언트 측에서 호출되어야 합니다.

사용

target 옵션을 사용하여 space-header를 다른 DOM 요소에 삽입합니다

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

// ...

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

이미 스페이스 데이터를 가지고 있다면, fetch를 피하기 위해 이를 매개변수로 전달할 수도 있습니다

init(space);

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