Class: DurableHuggingfaceHub::Types::SpaceInfo
- Includes:
- Loadable
- Defined in:
- lib/durable_huggingface_hub/types/space_info.rb
Overview
Information about a Space repository on HuggingFace Hub.
Spaces are interactive ML demos and applications hosted on HuggingFace Hub.
Instance Attribute Summary collapse
-
#author ⇒ String?
readonly
Author/organization name.
-
#card_data ⇒ Hash?
readonly
Space card metadata.
-
#created_at ⇒ Time?
readonly
Repository creation timestamp.
-
#disabled ⇒ Boolean?
readonly
Whether the repository is disabled.
-
#gated ⇒ Boolean, ...
readonly
Gated access status.
-
#id ⇒ String
readonly
Space repository ID.
-
#last_modified ⇒ Time?
readonly
Timestamp of last modification.
-
#likes ⇒ Integer?
readonly
Number of likes/stars.
-
#private ⇒ Boolean?
readonly
Whether the repository is private.
-
#runtime ⇒ Hash?
readonly
Runtime information (stage, hardware, etc.).
-
#sdk ⇒ String?
readonly
SDK used (e.g., “gradio”, “streamlit”, “static”).
-
#sha ⇒ String?
readonly
Git commit SHA of the current revision.
-
#siblings ⇒ Array<Hash>?
readonly
List of files in the repository.
-
#tags ⇒ Array<String>
readonly
Tags associated with the space.
Instance Method Summary collapse
-
#disabled? ⇒ Boolean
Checks if the repository is disabled.
-
#file_names ⇒ Array<String>
Returns the list of file names in the repository.
-
#gated? ⇒ Boolean
Checks if the repository is gated.
-
#has_tag?(tag) ⇒ Boolean
Checks if the space has a specific tag.
-
#inspect ⇒ String
Returns a detailed inspection string.
-
#public? ⇒ Boolean
Checks if the repository is public.
-
#running? ⇒ Boolean
Checks if the space is currently running.
-
#runtime_stage ⇒ String?
Returns the runtime stage if available.
-
#to_s ⇒ String
Returns a short description of the space.
Instance Attribute Details
#author ⇒ String? (readonly)
Returns Author/organization name.
64 |
# File 'lib/durable_huggingface_hub/types/space_info.rb', line 64 attribute :author, Types::OptionalString.default(nil) |
#card_data ⇒ Hash? (readonly)
Returns Space card metadata.
80 |
# File 'lib/durable_huggingface_hub/types/space_info.rb', line 80 attribute :card_data, Types::OptionalHash.default(nil) |
#created_at ⇒ Time? (readonly)
Returns Repository creation timestamp.
68 |
# File 'lib/durable_huggingface_hub/types/space_info.rb', line 68 attribute :created_at, Types::OptionalTimestamp.default(nil) |
#disabled ⇒ Boolean? (readonly)
Returns Whether the repository is disabled.
56 |
# File 'lib/durable_huggingface_hub/types/space_info.rb', line 56 attribute :disabled, Types::OptionalBool.default(nil) |
#gated ⇒ Boolean, ... (readonly)
Returns Gated access status.
52 |
# File 'lib/durable_huggingface_hub/types/space_info.rb', line 52 attribute :gated, Types::OptionalGated.default(nil) |
#id ⇒ String (readonly)
Returns Space repository ID.
28 |
# File 'lib/durable_huggingface_hub/types/space_info.rb', line 28 attribute :id, Types::RepoId |
#last_modified ⇒ Time? (readonly)
Returns Timestamp of last modification.
36 |
# File 'lib/durable_huggingface_hub/types/space_info.rb', line 36 attribute :last_modified, Types::OptionalTimestamp.default(nil) |
#likes ⇒ Integer? (readonly)
Returns Number of likes/stars.
60 |
# File 'lib/durable_huggingface_hub/types/space_info.rb', line 60 attribute :likes, Types::OptionalInteger.default(nil) |
#private ⇒ Boolean? (readonly)
Returns Whether the repository is private.
48 |
# File 'lib/durable_huggingface_hub/types/space_info.rb', line 48 attribute :private, Types::OptionalBool.default(nil) |
#runtime ⇒ Hash? (readonly)
Returns Runtime information (stage, hardware, etc.).
76 |
# File 'lib/durable_huggingface_hub/types/space_info.rb', line 76 attribute :runtime, Types::OptionalHash.default(nil) |
#sdk ⇒ String? (readonly)
Returns SDK used (e.g., “gradio”, “streamlit”, “static”).
72 |
# File 'lib/durable_huggingface_hub/types/space_info.rb', line 72 attribute :sdk, Types::OptionalString.default(nil) |
#sha ⇒ String? (readonly)
Returns Git commit SHA of the current revision.
32 |
# File 'lib/durable_huggingface_hub/types/space_info.rb', line 32 attribute :sha, Types::OptionalString.default(nil) |
#siblings ⇒ Array<Hash>? (readonly)
Returns List of files in the repository.
44 |
# File 'lib/durable_huggingface_hub/types/space_info.rb', line 44 attribute :siblings, Types::OptionalFileSiblings.default(nil) |
#tags ⇒ Array<String> (readonly)
Returns Tags associated with the space.
40 |
# File 'lib/durable_huggingface_hub/types/space_info.rb', line 40 attribute :tags, Types::StringArray.default([].freeze) |
Instance Method Details
#disabled? ⇒ Boolean
Checks if the repository is disabled.
121 122 123 |
# File 'lib/durable_huggingface_hub/types/space_info.rb', line 121 def disabled? disabled == true end |
#file_names ⇒ Array<String>
Returns the list of file names in the repository.
85 86 87 88 89 |
# File 'lib/durable_huggingface_hub/types/space_info.rb', line 85 def file_names return [] if siblings.nil? siblings.map { |s| s[:rfilename] || s["rfilename"] }.compact end |
#gated? ⇒ Boolean
Checks if the repository is gated.
109 110 111 112 113 114 115 116 |
# File 'lib/durable_huggingface_hub/types/space_info.rb', line 109 def gated? case gated when true, "auto", "manual" true else false end end |
#has_tag?(tag) ⇒ Boolean
Checks if the space has a specific tag.
95 96 97 |
# File 'lib/durable_huggingface_hub/types/space_info.rb', line 95 def has_tag?(tag) .include?(tag) end |
#inspect ⇒ String
Returns a detailed inspection string.
152 153 154 155 |
# File 'lib/durable_huggingface_hub/types/space_info.rb', line 152 def inspect "#<#{self.class.name} id=#{id.inspect} sdk=#{sdk.inspect} " \ "stage=#{runtime_stage.inspect}>" end |
#public? ⇒ Boolean
Checks if the repository is public.
102 103 104 |
# File 'lib/durable_huggingface_hub/types/space_info.rb', line 102 def public? !private end |
#running? ⇒ Boolean
Checks if the space is currently running.
135 136 137 |
# File 'lib/durable_huggingface_hub/types/space_info.rb', line 135 def running? runtime_stage == "RUNNING" end |
#runtime_stage ⇒ String?
Returns the runtime stage if available.
128 129 130 |
# File 'lib/durable_huggingface_hub/types/space_info.rb', line 128 def runtime_stage runtime&.dig("stage") || runtime&.dig(:stage) end |
#to_s ⇒ String
Returns a short description of the space.
142 143 144 145 146 147 |
# File 'lib/durable_huggingface_hub/types/space_info.rb', line 142 def to_s parts = [id] parts << "(#{sdk})" if sdk parts << "[#{runtime_stage}]" if runtime_stage parts.join(" ") end |