Class: DurableHuggingfaceHub::SpaceCard
- Defined in:
- lib/durable_huggingface_hub/repo_card.rb
Overview
Space card for documenting Spaces (interactive demos).
Space cards provide information about Gradio/Streamlit apps including:
-
App description and usage
-
Technical requirements
-
Model dependencies
Instance Attribute Summary
Attributes inherited from RepoCard
Class Method Summary collapse
-
.default_repo_type ⇒ String
Default repository type for space cards.
Instance Method Summary collapse
-
#validate ⇒ Array<String>
Validate space card metadata.
Methods inherited from RepoCard
from_hub, #initialize, load, parse, #push_to_hub, #save, #to_s, #update_metadata
Constructor Details
This class inherits a constructor from DurableHuggingfaceHub::RepoCard
Class Method Details
.default_repo_type ⇒ String
Returns Default repository type for space cards.
398 399 400 |
# File 'lib/durable_huggingface_hub/repo_card.rb', line 398 def self.default_repo_type "space" end |
Instance Method Details
#validate ⇒ Array<String>
Validate space card metadata.
405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 |
# File 'lib/durable_huggingface_hub/repo_card.rb', line 405 def validate errors = [] # Check for required fields errors << "sdk is required" unless @data["sdk"] errors << "app_file is required" unless @data["app_file"] # Validate SDK if @data["sdk"] && !["gradio", "streamlit", "docker", "static"].include?(@data["sdk"]) errors << "sdk must be one of: gradio, streamlit, docker, static" end # Validate app_file if @data["app_file"] && !@data["app_file"].is_a?(String) errors << "app_file must be a string" end # Validate sdk_version format if @data["sdk_version"] && !@data["sdk_version"].is_a?(String) errors << "sdk_version must be a string" end errors end |