Spaces:
Running
Running
submit: reject wrong-shaped predictions with a clear message
Browse files
app.py
CHANGED
|
@@ -492,6 +492,23 @@ def submit(s: Submission, request: Request):
|
|
| 492 |
if got < n:
|
| 493 |
raise HTTPException(400, "์์ธก์ด %d๊ฐ ํ์ํ๋ฐ %d๊ฐ๋ค. ๋น ํญ๋ชฉ์ ์ฑ์ ๋ณด๋ด๋ผ "
|
| 494 |
"- ์์๋ก ๋ฉ์ฐ๋ฉด ๊ทธ ๊ฐ์ด ์ ์์ ๋ค์ด๊ฐ๋ค" % (n, got))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 495 |
sid = hashlib.sha256(("%s|%s|%s|%f" % (s.board, u["user"], s.method, time.time()))
|
| 496 |
.encode()).hexdigest()[:16].upper()
|
| 497 |
rec = {"submission_id": sid, "board": s.board, "hf_user": u["user"],
|
|
|
|
| 492 |
if got < n:
|
| 493 |
raise HTTPException(400, "์์ธก์ด %d๊ฐ ํ์ํ๋ฐ %d๊ฐ๋ค. ๋น ํญ๋ชฉ์ ์ฑ์ ๋ณด๋ด๋ผ "
|
| 494 |
"- ์์๋ก ๋ฉ์ฐ๋ฉด ๊ทธ ๊ฐ์ด ์ ์์ ๋ค์ด๊ฐ๋ค" % (n, got))
|
| 495 |
+
# **๋ชจ์๋ ๋ณธ๋ค.** ์ถ์ด ์ฌ๋ฟ์ธ ๋ถ๋ฌธ์ ์ซ์ ํ๋๋ฅผ ๋ณด๋ด๋ฉด ์ฑ์ ๊ธฐ๋ ์ ๋ถ missing ์ผ๋ก
|
| 496 |
+
# ์ฒ๋ฆฌํ๊ณ ์ ์๊ฐ ๋น์ด์ ๋์์จ๋ค - ์ฐธ๊ฐ์๋ ๋ฌด์์ด ํ๋ ธ๋์ง ์ ๊ธธ์ด ์๋ค.
|
| 497 |
+
# ๊ฐ์๋ง ์ธ๊ณ ํต๊ณผ์ํค๋ฉด ๊ทธ ์นจ๋ฌต์ด ์ฐ๋ฆฌ ๋ชซ์ด ๋๋ค.
|
| 498 |
+
ax = b.get("axes")
|
| 499 |
+
if ax:
|
| 500 |
+
bad = [k for k, v in (s.predictions or {}).items()
|
| 501 |
+
if not (isinstance(v, (list, tuple)) and len(v) == ax)]
|
| 502 |
+
if bad:
|
| 503 |
+
raise HTTPException(400, "์ด ๋ถ๋ฌธ์ ํํฉ๋ฌผ๋ง๋ค ์ซ์ %d๊ฐ์ง๋ฆฌ ๋ฐฐ์ด์ด ํ์ํ๋ค. "
|
| 504 |
+
"%d๊ฑด์ด ๊ทธ ๋ชจ์์ด ์๋๋ค (์: %s). ํ์์ ๋ถ๋ฌธ ์๋ด๋ฅผ ๋ณด๋ผ"
|
| 505 |
+
% (ax, len(bad), bad[0]))
|
| 506 |
+
else:
|
| 507 |
+
bad = [k for k, v in (s.predictions or {}).items()
|
| 508 |
+
if isinstance(v, (list, tuple))]
|
| 509 |
+
if bad:
|
| 510 |
+
raise HTTPException(400, "์ด ๋ถ๋ฌธ์ ํํฉ๋ฌผ๋ง๋ค ์ซ์ ํ๋๊ฐ ํ์ํ๋ฐ ๋ฐฐ์ด์ด ์๋ค "
|
| 511 |
+
"(%d๊ฑด, ์: %s)" % (len(bad), bad[0]))
|
| 512 |
sid = hashlib.sha256(("%s|%s|%s|%f" % (s.board, u["user"], s.method, time.time()))
|
| 513 |
.encode()).hexdigest()[:16].upper()
|
| 514 |
rec = {"submission_id": sid, "board": s.board, "hf_user": u["user"],
|
i18n.js
CHANGED
|
@@ -97,6 +97,7 @@ ko: {
|
|
| 97 |
fMethod: "๋ฐฉ๋ฒ ์ด๋ฆ", fMethodH: "์์ํ์ ํ์๋ ๋ช
์นญ",
|
| 98 |
fTrain: "ํ์ต์ ์ฌ์ฉํ ๋ฐ์ดํฐ", fTrainH: "5์กฐ ๋์ถ ๊ฒ์ฌ์ ์ฌ์ฉํฉ๋๋ค",
|
| 99 |
fPred: "์์ธก๊ฐ", fPredH: "JSON ๋๋ CSV (compound_id, prediction)",
|
|
|
|
| 100 |
drop: "ํ์ผ์ ๋์ด๋ค ๋๊ฑฐ๋ ํด๋ฆญํ์ฌ ์ ํ",
|
| 101 |
send: "์ ์ถ", needLogin: "์ ์ถํ๋ ค๋ฉด HF ๊ณ์ ๋ก๊ทธ์ธ์ด ํ์ํฉ๋๋ค.",
|
| 102 |
step3d: "๋ชจ๋ธ๊ณผ ์ถ๋ก ํ๊ฒฝ์ ํจ๊ป ์ ์ถํ๋ฉด ์ง์ ์ฌ์คํํ์ฌ ๋์ผ ๊ฒฐ๊ณผ๋ฅผ ํ์ธํ๊ณ " +
|
|
@@ -296,6 +297,7 @@ en: {
|
|
| 296 |
fMethod: "Method name", fMethodH: "as it will appear on the leaderboard",
|
| 297 |
fTrain: "Training data used", fTrainH: "used for the clause 5 leakage screen",
|
| 298 |
fPred: "Predictions", fPredH: "JSON or CSV (compound_id, prediction)",
|
|
|
|
| 299 |
drop: "Drop a file here, or click to choose",
|
| 300 |
send: "Submit", needLogin: "Signing in with a Hugging Face account is required to submit.",
|
| 301 |
step3d: "Submit the model with its inference environment and we re-execute it, confirm the " +
|
|
|
|
| 97 |
fMethod: "๋ฐฉ๋ฒ ์ด๋ฆ", fMethodH: "์์ํ์ ํ์๋ ๋ช
์นญ",
|
| 98 |
fTrain: "ํ์ต์ ์ฌ์ฉํ ๋ฐ์ดํฐ", fTrainH: "5์กฐ ๋์ถ ๊ฒ์ฌ์ ์ฌ์ฉํฉ๋๋ค",
|
| 99 |
fPred: "์์ธก๊ฐ", fPredH: "JSON ๋๋ CSV (compound_id, prediction)",
|
| 100 |
+
fPredAx: n => `์ด ๋ถ๋ฌธ์ ์ถ์ด ${n}๊ฐ๋ค โ ํํฉ๋ฌผ๋ง๋ค ์ซ์ ${n}๊ฐ์ง๋ฆฌ ๋ฐฐ์ด์ JSON ์ผ๋ก ์ฌ๋ฆฐ๋ค`,
|
| 101 |
drop: "ํ์ผ์ ๋์ด๋ค ๋๊ฑฐ๋ ํด๋ฆญํ์ฌ ์ ํ",
|
| 102 |
send: "์ ์ถ", needLogin: "์ ์ถํ๋ ค๋ฉด HF ๊ณ์ ๋ก๊ทธ์ธ์ด ํ์ํฉ๋๋ค.",
|
| 103 |
step3d: "๋ชจ๋ธ๊ณผ ์ถ๋ก ํ๊ฒฝ์ ํจ๊ป ์ ์ถํ๋ฉด ์ง์ ์ฌ์คํํ์ฌ ๋์ผ ๊ฒฐ๊ณผ๋ฅผ ํ์ธํ๊ณ " +
|
|
|
|
| 297 |
fMethod: "Method name", fMethodH: "as it will appear on the leaderboard",
|
| 298 |
fTrain: "Training data used", fTrainH: "used for the clause 5 leakage screen",
|
| 299 |
fPred: "Predictions", fPredH: "JSON or CSV (compound_id, prediction)",
|
| 300 |
+
fPredAx: n => `This board has ${n} axes โ upload JSON with an array of ${n} numbers per compound`,
|
| 301 |
drop: "Drop a file here, or click to choose",
|
| 302 |
send: "Submit", needLogin: "Signing in with a Hugging Face account is required to submit.",
|
| 303 |
step3d: "Submit the model with its inference environment and we re-execute it, confirm the " +
|