Ahmedik95316 commited on
Commit
59c71e7
·
1 Parent(s): e9f59fc

Update monitor/monitor_drift.py

Browse files

Fixed the file paths to correctly point to `tmp` folder as the original paths are read-only

Files changed (1) hide show
  1. monitor/monitor_drift.py +22 -5
monitor/monitor_drift.py CHANGED
@@ -6,12 +6,29 @@ from scipy.spatial.distance import jensenshannon
6
  import joblib
7
  from datetime import datetime
8
 
9
- # Paths
10
- SCRAPED_PATH = Path("data/scraped_real.csv")
11
- TRAIN_PATH = Path("data/combined_dataset.csv")
12
- VECTORIZER_PATH = Path("model/vectorizer.pkl")
13
  # LOG_PATH = Path("logs/monitoring_log.json")
14
- LOG_PATH = Path("/tmp/monitoring_log.json")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15
 
16
 
17
  def compute_js_divergence(vec1, vec2):
 
6
  import joblib
7
  from datetime import datetime
8
 
9
+ # # Paths
10
+ # SCRAPED_PATH = Path("data/scraped_real.csv")
11
+ # TRAIN_PATH = Path("data/combined_dataset.csv")
12
+ # VECTORIZER_PATH = Path("model/vectorizer.pkl")
13
  # LOG_PATH = Path("logs/monitoring_log.json")
14
+
15
+ # Base directory (writable in Hugging Face/Docker)
16
+ BASE_DIR = Path("/tmp")
17
+
18
+ # Define and create directories
19
+ DATA_DIR = BASE_DIR / "data"
20
+ MODEL_DIR = BASE_DIR / "model"
21
+ LOGS_DIR = BASE_DIR / "logs"
22
+
23
+ DATA_DIR.mkdir(parents=True, exist_ok=True)
24
+ MODEL_DIR.mkdir(parents=True, exist_ok=True)
25
+ LOGS_DIR.mkdir(parents=True, exist_ok=True)
26
+
27
+ # Paths
28
+ SCRAPED_PATH = DATA_DIR / "scraped_real.csv"
29
+ TRAIN_PATH = DATA_DIR / "combined_dataset.csv"
30
+ VECTORIZER_PATH = MODEL_DIR / "vectorizer.pkl"
31
+ LOG_PATH = LOGS_DIR / "monitoring_log.json"
32
 
33
 
34
  def compute_js_divergence(vec1, vec2):