Hwihwa_Lab commited on
Commit
5cb6909
ยท
1 Parent(s): e780fe4

fix: enforce static sdk frontmatter in spaces README during automated deploy

Browse files
Files changed (1) hide show
  1. deploy_to_hf.py +27 -0
deploy_to_hf.py CHANGED
@@ -72,8 +72,35 @@ def deploy_spaces(api: Any, username: str, repo_name: str, token: str, current_d
72
  repo_type="space",
73
  token=token
74
  )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
75
  print(f"[โœ“] Spaces deployment complete! Live at: https://huggingface.co/spaces/{repo_id}")
76
 
 
77
  def deploy_models(api: Any, username: str, repo_name: str, token: str, current_dir: Path, bundle_zip: str):
78
  repo_id = f"{username}/{repo_name}"
79
  print(f"\n๐Ÿš€ [Models] Deploying to Hugging Face Model Hub: {repo_id}...")
 
72
  repo_type="space",
73
  token=token
74
  )
75
+
76
+ # Always ensure Space README has sdk: static configuration
77
+ space_readme = """---
78
+ title: CartPole-v1 Physical AI Cybernetic Lab
79
+ emoji: ๐Ÿช
80
+ colorFrom: blue
81
+ colorTo: indigo
82
+ sdk: static
83
+ pinned: false
84
+ ---
85
+
86
+ # ๐Ÿช CartPole-v1 Physical AI Interactive Cybernetic Lab
87
+
88
+ Live interactive physics simulator for PPO Neural Policy vs Classical Optimal LQR.
89
+
90
+ - ๐Ÿค– **Model Hub**: [hwihwalab/cartpole-v1-ppo](https://huggingface.co/hwihwalab/cartpole-v1-ppo)
91
+ - ๐Ÿ™ **GitHub**: [Hwihwa-Lab/cartpole-v1-ppo](https://github.com/Hwihwa-Lab/cartpole-v1-ppo)
92
+ """
93
+ api.upload_file(
94
+ path_or_fileobj=space_readme.encode("utf-8"),
95
+ path_in_repo="README.md",
96
+ repo_id=repo_id,
97
+ repo_type="space",
98
+ token=token
99
+ )
100
+
101
  print(f"[โœ“] Spaces deployment complete! Live at: https://huggingface.co/spaces/{repo_id}")
102
 
103
+
104
  def deploy_models(api: Any, username: str, repo_name: str, token: str, current_dir: Path, bundle_zip: str):
105
  repo_id = f"{username}/{repo_name}"
106
  print(f"\n๐Ÿš€ [Models] Deploying to Hugging Face Model Hub: {repo_id}...")