Hub Python Library
  • 🌍GET STARTED
    • Home
    • Quickstart
    • Installation
  • 🌍HOW-TO GUIDES
    • Overview
    • Download files
    • Upload files
    • BAFileSystem
    • Repository
    • Search
    • Inference
    • Community Tab
    • Collections
    • Cache
    • Model Cards
    • Manage your Space
    • Integrate a library
    • Webhooks server
  • 🌍CONCEPTUAL GUIDES
    • Git vs HTTP paradigm
  • 🌍REFERENCE
    • Overview
    • Login and logout
    • Environment variables
    • Managing local and online repositories
    • BOINC AI Hub API
    • Downloading files
    • Mixins & serialization methods
    • Inference Client
    • BaFileSystem
    • Utilities
    • Discussions and Pull Requests
    • Cache-system reference
    • Repo Cards and Repo Card Data
    • Space runtime
    • Collections
    • TensorBoard logger
    • Webhooks server
Powered by GitBook
On this page
  1. REFERENCE

Collections

PreviousSpace runtimeNextTensorBoard logger

Last updated 1 year ago

Managing collections

Check out the documentation page for the reference of methods to manage your Space on the Hub.

  • Get collection content:

  • Create new collection:

  • Update a collection:

  • Delete a collection:

  • Add an item to a collection:

  • Update an item in a collection:

  • Remove an item from a collection:

Collection

class huggingface_hub.Collection

( data: Dictendpoint: Optional[str] = None )

Parameters

  • slug (str) — Slug of the collection. E.g. "TheBloke/recent-models-64f9a55bb3115b4f513ec026".

  • title (str) — Title of the collection. E.g. "Recent models".

  • owner (str) — Owner of the collection. E.g. "TheBloke".

  • description (str, optional) — Description of the collection, as plain text.

  • items (List[CollectionItem]) — List of items in the collection.

  • last_updated (datetime) — Date of the last update of the collection.

  • position (int) — Position of the collection in the list of collections of the owner.

  • private (bool) — Whether the collection is private or not.

  • theme (str) — Theme of the collection. E.g. "green".

  • url (str) — URL for the collection on the Hub.

Contains information about a Collection on the Hub.

CollectionItem

class huggingface_hub.CollectionItem

( _id: strid: strtype: CollectionItemType_Tposition: intnote: Optional[Dict] = None**kwargs )

Parameters

  • item_object_id (str) — Unique ID of the item in the collection.

  • item_id (str) — ID of the underlying object on the Hub. Can be either a repo_id or a paper id e.g. "jbilcke-hf/ai-comic-factory", "2307.09288".

  • item_type (str) — Type of the underlying object. Can be one of "model", "dataset", "space" or "paper".

  • position (int) — Position of the item in the collection.

  • note (str, optional) — Note associated with the item, as plain text.

  • kwargs (Dict, optional) — Any other attribute returned by the server. Those attributes depend on the item_type: “author”, “private”, “lastModified”, “gated”, “title”, “likes”, “upvotes”, etc.

Contains information about an item of a Collection (model, dataset, Space or paper).

🌍
HfApi
get_collection()
create_collection()
update_collection_metadata()
delete_collection()
add_collection_item()
update_collection_item()
delete_collection_item()
<source>
<source>