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オプションを使用して、スペースヘッダーを別のDOM要素に注入します

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

// ...

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

スペースのデータが既に手元にある場合は、フェッチを回避するためにパラメータとして渡すこともできます。

init(space);

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