Spaces:
Runtime error
Runtime error
fix added
Browse files
app.py
CHANGED
|
@@ -14,31 +14,38 @@ from sklearn.metrics import accuracy_score, f1_score
|
|
| 14 |
from sklearn.model_selection import train_test_split
|
| 15 |
|
| 16 |
# =========================
|
| 17 |
-
# 1. DOWNLOAD DATASET
|
| 18 |
# =========================
|
| 19 |
url = "https://huggingface.co/datasets/ananyakarn/DAIC_WOZ_Data/resolve/main/DAIC_WOZ_Data.zip"
|
| 20 |
zip_path = "data.zip"
|
| 21 |
-
extract_path = "DAIC_WOZ"
|
| 22 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 23 |
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
|
| 28 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29 |
|
| 30 |
-
|
| 31 |
|
| 32 |
-
if
|
| 33 |
-
|
| 34 |
-
r = requests.get(url, stream=True)
|
| 35 |
-
with open(zip_path, "wb") as f:
|
| 36 |
-
for chunk in r.iter_content(8192):
|
| 37 |
-
f.write(chunk)
|
| 38 |
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
zip_ref.extractall(extract_path)
|
| 42 |
|
| 43 |
# =========================
|
| 44 |
# 2. LOAD LIGHTWEIGHT BERT
|
|
|
|
| 14 |
from sklearn.model_selection import train_test_split
|
| 15 |
|
| 16 |
# =========================
|
| 17 |
+
# 1. DOWNLOAD & EXTRACT DATASET
|
| 18 |
# =========================
|
| 19 |
url = "https://huggingface.co/datasets/ananyakarn/DAIC_WOZ_Data/resolve/main/DAIC_WOZ_Data.zip"
|
| 20 |
zip_path = "data.zip"
|
|
|
|
| 21 |
|
| 22 |
+
print("Downloading dataset...")
|
| 23 |
+
r = requests.get(url, stream=True)
|
| 24 |
+
with open(zip_path, "wb") as f:
|
| 25 |
+
for chunk in r.iter_content(8192):
|
| 26 |
+
f.write(chunk)
|
| 27 |
|
| 28 |
+
print("Extracting dataset...")
|
| 29 |
+
with zipfile.ZipFile(zip_path, "r") as zip_ref:
|
| 30 |
+
zip_ref.extractall(".")
|
| 31 |
|
| 32 |
+
# =========================
|
| 33 |
+
# 2. AUTO-DETECT DATASET FOLDER
|
| 34 |
+
# =========================
|
| 35 |
+
def find_dataset_root():
|
| 36 |
+
for root, dirs, files in os.walk("."):
|
| 37 |
+
for d in dirs:
|
| 38 |
+
if "_P" in d or "_C" in d:
|
| 39 |
+
return root
|
| 40 |
+
return None
|
| 41 |
|
| 42 |
+
extract_path = find_dataset_root()
|
| 43 |
|
| 44 |
+
if extract_path is None:
|
| 45 |
+
raise Exception("Dataset folders not found!")
|
|
|
|
|
|
|
|
|
|
|
|
|
| 46 |
|
| 47 |
+
print("Final dataset path:", extract_path)
|
| 48 |
+
print("Sample folders:", os.listdir(extract_path)[:10])
|
|
|
|
| 49 |
|
| 50 |
# =========================
|
| 51 |
# 2. LOAD LIGHTWEIGHT BERT
|