From 258963c728665c9e4d4a09c770d43da920a5e48e Mon Sep 17 00:00:00 2001 From: MaxVorosh Date: Sun, 10 Dec 2023 09:42:56 -0500 Subject: [PATCH 1/4] Add load possibility for zip --- server/api/server.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/server/api/server.cpp b/server/api/server.cpp index 69387277..6c4e7f6e 100644 --- a/server/api/server.cpp +++ b/server/api/server.cpp @@ -4,11 +4,10 @@ #include #include +#include #include - #include - #include #include #include @@ -22,7 +21,6 @@ #include "GraphBuilder.h" #include "CsvLoader.h" #include "DataMarker.h" -#include using namespace std; using namespace crow; From d95432cdc403adf673033f06c30650fecead2049 Mon Sep 17 00:00:00 2001 From: Artem Goldenberg Date: Tue, 12 Dec 2023 23:11:16 +0300 Subject: [PATCH 2/4] uploading zip --- .github/workflows/CI.yml | 1 + .gitignore | 5 ++++ client/scripts/requests.js | 37 +++++++++++++++++++++++++++ client/templates/main.html | 34 ++++++++----------------- py_server/mlcraft/__init__.py | 1 + py_server/mlcraft/dataset.py | 48 ----------------------------------- py_server/mlcraft/errors.py | 2 +- py_server/mlcraft/server.py | 26 +++++++++++-------- server/api/server.cpp | 47 ++++++++++++++++------------------ 9 files changed, 93 insertions(+), 108 deletions(-) delete mode 100644 py_server/mlcraft/dataset.py diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index adea88ef..9554a42c 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -51,6 +51,7 @@ jobs: sudo apt install -y g++-11 sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-11 90 sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-11 90 + sudo apt install libzip-dev - name: install-cpprest run: sudo apt install libcpprest-dev diff --git a/.gitignore b/.gitignore index 48b197a5..f966ca0c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,10 @@ Build/ build/ +# Large-files +zip-examples +model_data + # IDE .vscode .idea @@ -10,6 +14,7 @@ build/ .DS_Store .AppleDouble .LSOverride +*.entitlements # Javascript package-lock.json diff --git a/client/scripts/requests.js b/client/scripts/requests.js index 35124124..491cbd73 100644 --- a/client/scripts/requests.js +++ b/client/scripts/requests.js @@ -124,6 +124,43 @@ async function deleteConnection(sending_object) { return response } +function uploadRequest() { + if (data_upload.files.length == 0) return + const file = data_upload.files[0] + + fetch(`http://${py_server_address}/${user_id}/${model_id}`, { + method: "PATCH", + mode: "cors", + body: file, + }).then(response => { + if (!response.ok) { + Swal.fire({ + position: "top-end", + icon: "error", + title: "Failed to upload data", + showConfirmButton: false, + timer: 1500, + }) + console.error(`Failed to upload data for ${file.name}`) + return + } + Swal.fire({ + position: "top-end", + icon: "success", + title: "Successfully uploaded", + showConfirmButton: false, + timer: 1500, + }) + }) + setModelView("irrelevant") + // allow user to press a train button from now on + button_wrapper = document.getElementById("train-button") + button_wrapper.getElementsByTy + train_button = button_wrapper.children[0] + button_wrapper.removeAttribute("disabled") + train_button.removeAttribute("disabled") +} + function trainRequest() { if (!train_data) { errorNotification("No training data was set.") diff --git a/client/templates/main.html b/client/templates/main.html index 15250f5d..bc0de581 100644 --- a/client/templates/main.html +++ b/client/templates/main.html @@ -113,7 +113,7 @@

MLCraft