Ozziejoe commited on
Commit
372700f
·
verified ·
1 Parent(s): 8b9a1f1

Update pipeline.py

Browse files
Files changed (1) hide show
  1. pipeline.py +23 -0
pipeline.py CHANGED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import pandas as pd
3
+ import requests
4
+ from io import StringIO
5
+
6
+ # Get Hugging Face token from your Space secret
7
+ token = os.getenv("HF_TOKEN")
8
+
9
+ # ✅ Correct URL for your actual file
10
+ url = "https://huggingface.co/datasets/Ozziejoe/initialEEMMratings/resolve/main/clear_item_df.csv"
11
+
12
+ # Authenticated request to access private dataset
13
+ headers = {"Authorization": f"Bearer {token}"}
14
+ response = requests.get(url, headers=headers)
15
+ response.raise_for_status() # Will raise an error if URL is bad or access is denied
16
+
17
+ # Read the CSV directly from the response
18
+ df = pd.read_csv(StringIO(response.text))
19
+
20
+ # Save locally as processed version
21
+ df.to_csv("processed_eemm.csv", index=False)
22
+
23
+ print("✅ File downloaded and saved as processed_eemm.csv")