diff --git a/apps/css/testing_interface.css b/apps/css/testing_interface.css index 4d6dadd02..05fb26119 100644 --- a/apps/css/testing_interface.css +++ b/apps/css/testing_interface.css @@ -167,3 +167,56 @@ input, button { #modal input { margin-left: 70px; } + +#task_id_selector, #task_id_selector_main { + margin: 10px 0; + display: inline-flex; + align-items: center; + gap: 5px; + white-space: nowrap; +} + +#task_id_input, #task_id_input_main { + width: 100px; + padding: 2px 5px; + margin: 0 5px; +} + +#load_task_id_btn, #load_task_id_btn_main { + padding: 2px 10px; + margin: 0 5px; +} + +#error_display { + color: red; + margin-top: 10px; + display: none; +} + +#modal #task_id_selector { + margin-top: 20px; + display: inline-flex; + justify-content: center; +} + +#modal #modal_task_id_input { + width: 100px; + padding: 2px 5px; + margin: 0 5px; +} + +#modal #modal_load_task_id_btn { + margin: 0; + padding: 2px 10px; +} + +.task_type_select { + padding: 2px 5px; + margin: 0 5px; + width: auto; + min-width: 120px; +} + +#modal .task_type_select { + margin: 0 5px; +} diff --git a/apps/js/testing_interface.js b/apps/js/testing_interface.js index 51d26a4b3..dc8822ad8 100644 --- a/apps/js/testing_interface.js +++ b/apps/js/testing_interface.js @@ -270,6 +270,46 @@ function initializeSelectable() { } } +function loadTaskById(inputElementId = 'task_id_input') { + const taskId = document.getElementById(inputElementId).value.trim(); + if (!taskId) { + errorMsg("Please enter a task ID"); + return; + } + + const selectId = inputElementId === 'task_id_input' ? 'task_type_select' : 'task_type_select_main'; + const taskType = document.getElementById(selectId).value; + const taskTypeDisplay = taskType === 'evaluation' ? 'evaluation set' : 'training set'; + + $.getJSON(`https://api.github.com/repos/fchollet/ARC/contents/data/${taskType}/${taskId}.json`, function(data) { + try { + const decodedContent = atob(data.content); + const json = JSON.parse(decodedContent); + train = json.train; + test = json.test; + } catch (e) { + errorMsg('Bad file format'); + return; + } + loadJSONTask(train, test); + $('#modal_bg').hide(); + infoMsg(`Loaded task from ${taskTypeDisplay}: ${taskId}`); + display_task_name(`${taskId} (${taskTypeDisplay})`, null, null); + }) + .error(function(){ + errorMsg('Error loading task'); + }); +} + +function displayError(message) { + const errorDisplay = document.getElementById('error_display'); + errorDisplay.textContent = message; + errorDisplay.style.display = 'block'; + setTimeout(() => { + errorDisplay.style.display = 'none'; + }, 3000); +} + // Initial event binding. $(document).ready(function () { diff --git a/apps/testing_interface.html b/apps/testing_interface.html index 3b4dcff01..9038f99bf 100644 --- a/apps/testing_interface.html +++ b/apps/testing_interface.html @@ -22,6 +22,16 @@
+ +
+ + + + +
@@ -48,8 +58,19 @@ + +
+ + + + +
+

- +