raghuram00 commited on
Commit
8836bc2
·
1 Parent(s): c75e060

chore: add google drive IDs to downloader

Browse files
Files changed (1) hide show
  1. download_model.py +9 -10
download_model.py CHANGED
@@ -10,12 +10,10 @@ print("---------------------------------------------------------")
10
  # The File ID is: 1A2B3C4D5E
11
 
12
  # 1. Google Drive File ID for best_model.pt
13
- MODEL_FILE_ID = "YOUR_MODEL_FILE_ID_HERE"
14
 
15
- # 2. Google Drive File ID for label_encoder.pkl (if you didn't commit it)
16
- # By default, I am leaving the Hugging Face link here just for the 1KB encoder so you don't have to upload it twice.
17
- # If you want it from GDrive too, uncomment and put the ID!
18
- # ENCODER_FILE_ID = "YOUR_ENCODER_FILE_ID_HERE"
19
 
20
  if not os.path.exists("best_model.pt"):
21
  if MODEL_FILE_ID == "YOUR_MODEL_FILE_ID_HERE":
@@ -29,10 +27,11 @@ if not os.path.exists("best_model.pt"):
29
  else:
30
  print("✅ best_model.pt already exists locally. Skipping download.")
31
 
32
- # Download tiny encoder either from GitHub or HF (it's only 1KB so it doesn't cause LFS issues)
33
  if not os.path.exists("label_encoder.pkl"):
34
- import urllib.request
35
- print("Downloading label_encoder.pkl...")
36
- url_le = "https://huggingface.co/spaces/raghuram00/code-complexity-predictor/resolve/main/label_encoder.pkl"
37
- urllib.request.urlretrieve(url_le, "label_encoder.pkl")
 
 
38
  print("✅ Encoder downloaded successfully!")
 
10
  # The File ID is: 1A2B3C4D5E
11
 
12
  # 1. Google Drive File ID for best_model.pt
13
+ MODEL_FILE_ID = "1eFqWSvXSl-bcaPXh6LCG2uQmBmEF5GGJ"
14
 
15
+ # 2. Google Drive File ID for label_encoder.pkl
16
+ ENCODER_FILE_ID = "YOUR_ENCODER_FILE_ID_HERE"
 
 
17
 
18
  if not os.path.exists("best_model.pt"):
19
  if MODEL_FILE_ID == "YOUR_MODEL_FILE_ID_HERE":
 
27
  else:
28
  print("✅ best_model.pt already exists locally. Skipping download.")
29
 
 
30
  if not os.path.exists("label_encoder.pkl"):
31
+ if ENCODER_FILE_ID == "YOUR_ENCODER_FILE_ID_HERE":
32
+ print(" ERROR: You did not paste your Google Drive tracking ID for label_encoder.pkl!")
33
+ exit(1)
34
+
35
+ print("Downloading label_encoder.pkl from Google Drive...")
36
+ gdown.download(id=ENCODER_FILE_ID, output="label_encoder.pkl", quiet=False)
37
  print("✅ Encoder downloaded successfully!")