Skip to content

Commit f2f6325

Browse files
committed
implemented getProject, added to notebook
1 parent 1e6fca0 commit f2f6325

2 files changed

Lines changed: 26 additions & 15 deletions

File tree

main.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
initDatasetIncrement = "/api/deviceApi/initDatasetIncrement"
77
addDatasetIncrement = "/api/deviceApi/addDatasetIncrement"
88
addDatasetIncrementBatch = "/api/deviceApi/addDatasetIncrementBatch"
9+
getProjectEndpoint = "/api/deviceApi/getProject"
910

1011
#
1112
# Uploads a whole dataset to a specific project
@@ -21,6 +22,16 @@ def sendDataset(url: str, key: str, dataset: dict):
2122
except req.exceptions.RequestException:
2223
raise "error" #TODO
2324

25+
#
26+
# Returns the all datasets and labels belonging to a project
27+
# Can be used for further processing
28+
# @param {string} url - The url of the backend server
29+
# @param {string} key - The Device-Api-Key
30+
#
31+
32+
def getProject(url: str, key: str):
33+
res = req.post(url + getProjectEndpoint, json = {"key": key})
34+
return res.json()
2435

2536
#
2637
# @param {string} url - The url of the backend server

notebook.ipynb

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"cells": [
33
{
44
"cell_type": "code",
5-
"execution_count": 1,
5+
"execution_count": 11,
66
"metadata": {},
77
"outputs": [],
88
"source": [
@@ -15,7 +15,7 @@
1515
},
1616
{
1717
"cell_type": "code",
18-
"execution_count": 2,
18+
"execution_count": 12,
1919
"metadata": {},
2020
"outputs": [],
2121
"source": [
@@ -35,7 +35,7 @@
3535
},
3636
{
3737
"cell_type": "code",
38-
"execution_count": 3,
38+
"execution_count": 13,
3939
"metadata": {},
4040
"outputs": [
4141
{
@@ -47,14 +47,14 @@
4747
}
4848
],
4949
"source": [
50-
"res = req.post(\"http://localhost:3000/api/deviceApi/getProject\", json = {\"key\": key})\n",
51-
"dataPoints = res.json()['datasets'][0]['sensors'][0]['data']\n",
50+
"project = edgeml.getProject(\"http://localhost\", key)\n",
51+
"dataPoints = project['datasets'][0]['sensors'][0]['data']\n",
5252
"print(dataPoints)"
5353
]
5454
},
5555
{
5656
"cell_type": "code",
57-
"execution_count": 4,
57+
"execution_count": 14,
5858
"metadata": {},
5959
"outputs": [
6060
{
@@ -88,14 +88,14 @@
8888
},
8989
{
9090
"cell_type": "code",
91-
"execution_count": 5,
91+
"execution_count": 15,
9292
"metadata": {},
9393
"outputs": [
9494
{
9595
"name": "stderr",
9696
"output_type": "stream",
9797
"text": [
98-
"Feature Extraction: 100%|██████████| 30/30 [00:00<00:00, 316.30it/s]"
98+
"Feature Extraction: 100%|██████████| 30/30 [00:00<00:00, 327.22it/s]"
9999
]
100100
},
101101
{
@@ -160,7 +160,7 @@
160160
},
161161
{
162162
"cell_type": "code",
163-
"execution_count": 6,
163+
"execution_count": 16,
164164
"metadata": {},
165165
"outputs": [],
166166
"source": [
@@ -170,7 +170,7 @@
170170
},
171171
{
172172
"cell_type": "code",
173-
"execution_count": 7,
173+
"execution_count": 17,
174174
"metadata": {},
175175
"outputs": [
176176
{
@@ -338,7 +338,7 @@
338338
"max 0.960000 0.960000 0.960000 "
339339
]
340340
},
341-
"execution_count": 7,
341+
"execution_count": 17,
342342
"metadata": {},
343343
"output_type": "execute_result"
344344
}
@@ -355,7 +355,7 @@
355355
},
356356
{
357357
"cell_type": "code",
358-
"execution_count": 8,
358+
"execution_count": 18,
359359
"metadata": {},
360360
"outputs": [
361361
{
@@ -364,7 +364,7 @@
364364
"RandomForestClassifier()"
365365
]
366366
},
367-
"execution_count": 8,
367+
"execution_count": 18,
368368
"metadata": {},
369369
"output_type": "execute_result"
370370
}
@@ -377,14 +377,14 @@
377377
},
378378
{
379379
"cell_type": "code",
380-
"execution_count": 9,
380+
"execution_count": 19,
381381
"metadata": {},
382382
"outputs": [
383383
{
384384
"name": "stdout",
385385
"output_type": "stream",
386386
"text": [
387-
"accuracy_score train : 0.5093333333333333\n"
387+
"accuracy_score train : 0.5066666666666667\n"
388388
]
389389
}
390390
],

0 commit comments

Comments
 (0)