Spaces:
Sleeping
Sleeping
File size: 1,029 Bytes
c3192e0 85329e6 c3192e0 85329e6 c3192e0 85329e6 c3192e0 85329e6 c3192e0 85329e6 c3192e0 85329e6 c3192e0 85329e6 c3192e0 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | # save as fix_notebooks.py in project root
import json
import os
notebooks = [
"notebooks/03_evaluate.ipynb",
"notebooks/04_optuna_hpo.ipynb",
]
for path in notebooks:
if not os.path.exists(path):
print(f"❌ Not found: {path}")
continue
with open(path, "r", encoding="utf-8") as f:
nb = json.load(f)
# Remove widgets from metadata
if "widgets" in nb.get("metadata", {}):
del nb["metadata"]["widgets"]
print(f"✅ Removed metadata.widgets from {path}")
# Remove widgets from each cell
for cell in nb.get("cells", []):
if "widgets" in cell.get("metadata", {}):
del cell["metadata"]["widgets"]
with open(path, "w", encoding="utf-8") as f:
json.dump(nb, f, indent=1, ensure_ascii=False)
print(f"✅ Fixed: {path}")
print("\nDone! Now run:")
print("git add notebooks/03_evaluate.ipynb notebooks/04_optuna_hpo.ipynb")
print("git commit -m '🔧 Fix widget metadata for GitHub rendering'")
print("git push origin main") |