Hub Python 函式庫文件
管理收藏
立即開始
操作指南
總覽下載檔案上傳檔案儲存桶使用 CLI建立 CLI 擴充功能HfFileSystem儲存庫搜尋推論Inference Endpoints(推論端點)Jobs社群分頁選集 (Collections)快取 (Cache)模型卡片管理您的 Space整合函式庫Webhooks
概念指南
參考
加入 Hugging Face 社群
並獲得增強的文件體驗
開始使用
管理收藏
請查看 HfApi 文件頁面,以取得管理您 Hub 上 Space 的方法參考。
- 取得收藏內容: get_collection()
- 建立新收藏: create_collection()
- 更新收藏: update_collection_metadata()
- 刪除收藏: delete_collection()
- 將項目新增至收藏: add_collection_item()
- 更新收藏中的項目: update_collection_item()
- 從收藏中移除項目: delete_collection_item()
Collection
class huggingface_hub.Collection
< 原始碼 >( **kwargs )
參數
- slug (
str) — 收藏的識別名稱 (slug)。例如:"TheBloke/recent-models-64f9a55bb3115b4f513ec026"。 - title (
str) — 收藏標題。例如:"Recent models"。 - owner (
str) — 收藏擁有者。例如:"TheBloke"。 - items (
list[CollectionItem]) — 收藏中的項目列表。 - last_updated (
datetime) — 收藏上次更新的日期。 - position (
int) — 收藏在擁有者收藏列表中的位置。 - private (
bool) — 收藏是否為私有。 - theme (
str) — 收藏主題。例如:"green"。 - upvotes (
int) — 收藏的點讚數。 - description (
str, optional) — 收藏說明(純文字)。 - url (
str) — (屬性) 收藏在 Hub 上的 URL。
包含 Hub 上 Collection 的相關資訊。
CollectionItem
class huggingface_hub.CollectionItem
< 原始碼 >( _id: str id: str type: CollectionItemType_T position: int note: dict | None = None **kwargs )
參數
- item_object_id (
str) — 收藏中項目的唯一識別碼 (ID)。 - item_id (
str) — Hub 上底層物件的 ID。可以是 repo_id、paper id、collection slug 或 bucket id。例如:"jbilcke-hf/ai-comic-factory"、"2307.09288"、"celinah/cerebras-function-calling-682607169c35fbfa98b30b9a"。 - item_type (
str) — 底層物件的類型。可以是"model"、"dataset"、"space"、"paper"、"collection"或"bucket"之一。 - position (
int) — 項目在收藏中的位置。 - note (
str, optional) — 與項目關聯的備註(純文字)。
包含關於 Collection(模型、資料集、Space、論文、收藏或儲存桶)項目的相關資訊。