Spaces:
Runtime error
Runtime error
Update pipeline.py
Browse files- pipeline.py +0 -23
pipeline.py
CHANGED
@@ -1,23 +0,0 @@
|
|
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")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|