Huggingface.js documentation

🤗 ترويسة مساحة Hugging Face

Hugging Face's logo
Join the Hugging Face community

and get access to the augmented documentation experience

to get started

🤗 ترويسة مساحة Hugging Face

غلاف يعمل بلغة Typescript لميزة mini_header الخاصة بالمساحة.

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