-
Notifications
You must be signed in to change notification settings - Fork 1
/
generate_samples.py
41 lines (38 loc) · 1.24 KB
/
generate_samples.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import wget
import os
endpoints = [
{
'route':'score-regression/knn/evaluate',
'filename': 'knn_regression_evaluation.json'
},
{
'route':'score-regression/random-forest/evaluate',
'filename': 'rf_regression_evaluation.json'
},
{
'route':'region-classification/knn/evaluate',
'filename': 'knn_region_classification_evaluation.json'
},
{
'route':'region-classification/random-forest/evaluate',
'filename': 'rf_region_classification_evaluation.json'
},
{
'route':'region-classification/knn/balanced/evaluate',
'filename': 'knn_region_classification_balanced_evaluation.json'
},
{
'route':'region-classification/random-forest/balanced/evaluate',
'filename': 'rf_region_classification_balanced_evaluation.json'
},
]
def download_sample(route:str, filename: str):
url = f'http://localhost:8000/{route}'
base_path = './docs/api_return_samples'
save_path = f'{base_path}/{filename}'
if(os.path.exists(save_path)):
os.remove(save_path)
wget.download(url, save_path)
for endpoint in endpoints:
download_sample(endpoint['route'], endpoint['filename'])
print(f'Downloaded {endpoint["filename"]}')