Create app.py
Browse files
app.py
CHANGED
|
@@ -74,8 +74,22 @@ def ensure_loaded():
|
|
| 74 |
if QUESTIONS is not None:
|
| 75 |
return
|
| 76 |
|
| 77 |
-
|
| 78 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 79 |
out = []
|
| 80 |
|
| 81 |
for i,row in enumerate(split):
|
|
@@ -251,4 +265,4 @@ with gr.Blocks(css=CSS,title="SAT Math Trainer") as demo:
|
|
| 251 |
nextb.click(next_q, st, [img,weakb,result])
|
| 252 |
weakb.click(start_weak, st, [img,weakb,result])
|
| 253 |
|
| 254 |
-
demo.launch()
|
|
|
|
| 74 |
if QUESTIONS is not None:
|
| 75 |
return
|
| 76 |
|
| 77 |
+
ds = load_dataset(DATASET_NAME)
|
| 78 |
+
|
| 79 |
+
# ✅ train이 없을 수 있어서 안전하게 split 자동 선택
|
| 80 |
+
if isinstance(ds, dict) and len(ds.keys()) > 0:
|
| 81 |
+
# DatasetDict일 때
|
| 82 |
+
if "train" in ds:
|
| 83 |
+
split = ds["train"]
|
| 84 |
+
elif "test" in ds:
|
| 85 |
+
split = ds["test"]
|
| 86 |
+
elif "validation" in ds:
|
| 87 |
+
split = ds["validation"]
|
| 88 |
+
else:
|
| 89 |
+
split = ds[list(ds.keys())[0]]
|
| 90 |
+
else:
|
| 91 |
+
# 단일 Dataset일 때
|
| 92 |
+
split = ds
|
| 93 |
out = []
|
| 94 |
|
| 95 |
for i,row in enumerate(split):
|
|
|
|
| 265 |
nextb.click(next_q, st, [img,weakb,result])
|
| 266 |
weakb.click(start_weak, st, [img,weakb,result])
|
| 267 |
|
| 268 |
+
demo.launch()
|