Spaces:
Running
Running
Delete download_private_code.py
Browse files- download_private_code.py +0 -37
download_private_code.py
DELETED
|
@@ -1,37 +0,0 @@
|
|
| 1 |
-
# src/download_private_model.py
|
| 2 |
-
import os
|
| 3 |
-
import requests
|
| 4 |
-
from pathlib import Path
|
| 5 |
-
|
| 6 |
-
MODEL_DIR = Path("/src/FineTune")
|
| 7 |
-
MODEL_PATH = MODEL_DIR / "model.py"
|
| 8 |
-
|
| 9 |
-
def download_model():
|
| 10 |
-
print("📥 Checking private model file...")
|
| 11 |
-
if MODEL_PATH.exists():
|
| 12 |
-
print(f"✅ model.py already exists at {MODEL_PATH}")
|
| 13 |
-
return
|
| 14 |
-
|
| 15 |
-
hf_token = os.getenv("HF_TOKEN")
|
| 16 |
-
if not hf_token:
|
| 17 |
-
raise RuntimeError(
|
| 18 |
-
"❌ HF_TOKEN not found. Please set it in Hugging Face Space → Settings → Secrets."
|
| 19 |
-
)
|
| 20 |
-
|
| 21 |
-
url = "https://huggingface.co/mamba413/ada-core/resolve/main/model.py"
|
| 22 |
-
headers = {"Authorization": f"Bearer {hf_token}"}
|
| 23 |
-
MODEL_DIR.mkdir(parents=True, exist_ok=True)
|
| 24 |
-
|
| 25 |
-
print(f"📡 Downloading from {url}")
|
| 26 |
-
response = requests.get(url, headers=headers)
|
| 27 |
-
if response.status_code != 200:
|
| 28 |
-
raise RuntimeError(
|
| 29 |
-
f"❌ Failed to download model.py (HTTP {response.status_code}): {response.text[:200]}"
|
| 30 |
-
)
|
| 31 |
-
|
| 32 |
-
with open(MODEL_PATH, "wb") as f:
|
| 33 |
-
f.write(response.content)
|
| 34 |
-
print(f"✅ Successfully downloaded model.py to {MODEL_PATH}")
|
| 35 |
-
|
| 36 |
-
if __name__ == "__main__":
|
| 37 |
-
download_model()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|