Spaces:
Sleeping
Sleeping
jefffffff9 Claude Sonnet 4.6 commited on
Commit ·
4bd45bb
1
Parent(s): bfa9d46
Add Kaggle auto-sync: kernel-metadata.json + post-commit hook
Browse files- notebooks/kernel-metadata.json: tells the Kaggle API the kernel ID,
title, GPU flag, and which .ipynb to upload
- scripts/push_to_kaggle.sh: runs 'kaggle kernels push' from the
notebooks/ directory; checks for kaggle CLI and kaggle.json first
- .git/hooks/post-commit: detects if kaggle_master_trainer.ipynb was
in the commit and calls push_to_kaggle.sh automatically
Setup (one-time):
pip install kaggle
# download kaggle.json from kaggle.com → Settings → API
cp ~/Downloads/kaggle.json ~/.kaggle/kaggle.json
After that, every 'git commit' that touches the notebook will push
the updated version to Kaggle automatically.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- notebooks/kernel-metadata.json +14 -0
- scripts/push_to_kaggle.sh +38 -0
notebooks/kernel-metadata.json
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"id": "ous-sow/sahel-voice-master-trainer",
|
| 3 |
+
"title": "Sahel-Voice-Core — Master Trainer",
|
| 4 |
+
"code_file": "kaggle_master_trainer.ipynb",
|
| 5 |
+
"language": "python",
|
| 6 |
+
"kernel_type": "notebook",
|
| 7 |
+
"is_private": true,
|
| 8 |
+
"enable_gpu": true,
|
| 9 |
+
"enable_tpu": false,
|
| 10 |
+
"enable_internet": true,
|
| 11 |
+
"dataset_sources": [],
|
| 12 |
+
"competition_sources": [],
|
| 13 |
+
"kernel_sources": []
|
| 14 |
+
}
|
scripts/push_to_kaggle.sh
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env bash
|
| 2 |
+
# push_to_kaggle.sh — Push the master trainer notebook to Kaggle.
|
| 3 |
+
#
|
| 4 |
+
# Called automatically by .git/hooks/post-commit when the notebook changes,
|
| 5 |
+
# or run manually:
|
| 6 |
+
# bash scripts/push_to_kaggle.sh
|
| 7 |
+
#
|
| 8 |
+
# Requirements:
|
| 9 |
+
# pip install kaggle
|
| 10 |
+
# Place ~/.kaggle/kaggle.json (download from kaggle.com → Settings → API)
|
| 11 |
+
|
| 12 |
+
set -euo pipefail
|
| 13 |
+
|
| 14 |
+
NOTEBOOK_DIR="$(cd "$(dirname "$0")/../notebooks" && pwd)"
|
| 15 |
+
NOTEBOOK_FILE="$NOTEBOOK_DIR/kaggle_master_trainer.ipynb"
|
| 16 |
+
METADATA_FILE="$NOTEBOOK_DIR/kernel-metadata.json"
|
| 17 |
+
|
| 18 |
+
# ── Prerequisite check ────────────────────────────────────────────────────────
|
| 19 |
+
if ! command -v kaggle &>/dev/null; then
|
| 20 |
+
echo "kaggle CLI not found — run: pip install kaggle"
|
| 21 |
+
exit 1
|
| 22 |
+
fi
|
| 23 |
+
|
| 24 |
+
if [[ ! -f "$HOME/.kaggle/kaggle.json" ]]; then
|
| 25 |
+
echo "kaggle.json not found at ~/.kaggle/kaggle.json"
|
| 26 |
+
echo "Download it from: kaggle.com → Account → Settings → API → Create New Token"
|
| 27 |
+
exit 1
|
| 28 |
+
fi
|
| 29 |
+
chmod 600 "$HOME/.kaggle/kaggle.json"
|
| 30 |
+
|
| 31 |
+
# ── Push ──────────────────────────────────────────────────────────────────────
|
| 32 |
+
echo "Pushing notebook to Kaggle..."
|
| 33 |
+
echo " Notebook : $NOTEBOOK_FILE"
|
| 34 |
+
echo " Metadata : $METADATA_FILE"
|
| 35 |
+
|
| 36 |
+
kaggle kernels push -p "$NOTEBOOK_DIR"
|
| 37 |
+
|
| 38 |
+
echo "✅ Done — view at: https://www.kaggle.com/code/ous-sow/sahel-voice-master-trainer"
|