Spaces:
Sleeping
Sleeping
nastasiasnk
commited on
Commit
•
a4d5793
1
Parent(s):
edc370b
Update app.py
Browse files
app.py
CHANGED
@@ -10,10 +10,6 @@ from collections import OrderedDict
|
|
10 |
|
11 |
|
12 |
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
def test(input_json):
|
18 |
print("Received input")
|
19 |
# Parse the input JSON string
|
@@ -22,16 +18,17 @@ def test(input_json):
|
|
22 |
except json.JSONDecodeError:
|
23 |
inputs = json.loads(input_json.replace("'", '"'))
|
24 |
|
25 |
-
# Accessing
|
26 |
ids_index = inputs['input']['ids_list']
|
27 |
weightsNames = inputs['input']["weights_names"]
|
28 |
|
29 |
-
# Extract the datatree part which is a list of dictionaries
|
30 |
matrix = inputs['input']["matrix"]
|
31 |
weights = inputs['input']["weights"]
|
|
|
32 |
|
33 |
attributeMapperDict = inputs['input']["attributeMapperDict"]
|
34 |
-
|
|
|
35 |
alpha = inputs['input']["alpha"]
|
36 |
alpha = float(alpha)
|
37 |
threshold = inputs['input']["threshold"]
|
@@ -39,8 +36,10 @@ def test(input_json):
|
|
39 |
|
40 |
df_matrix = pd.DataFrame(matrix).T
|
41 |
df_weights = pd.DataFrame(weights).T
|
|
|
42 |
df_matrix = df_matrix.round(0).astype(int)
|
43 |
df_weights = df_weights.round(0).astype(int)
|
|
|
44 |
|
45 |
|
46 |
|
|
|
10 |
|
11 |
|
12 |
|
|
|
|
|
|
|
|
|
13 |
def test(input_json):
|
14 |
print("Received input")
|
15 |
# Parse the input JSON string
|
|
|
18 |
except json.JSONDecodeError:
|
19 |
inputs = json.loads(input_json.replace("'", '"'))
|
20 |
|
21 |
+
# Accessing input data
|
22 |
ids_index = inputs['input']['ids_list']
|
23 |
weightsNames = inputs['input']["weights_names"]
|
24 |
|
|
|
25 |
matrix = inputs['input']["matrix"]
|
26 |
weights = inputs['input']["weights"]
|
27 |
+
landuses = inputs['input']["landuses"]
|
28 |
|
29 |
attributeMapperDict = inputs['input']["attributeMapperDict"]
|
30 |
+
landuseMapperDict = inputs['input']["landuseMapperDict"]
|
31 |
+
|
32 |
alpha = inputs['input']["alpha"]
|
33 |
alpha = float(alpha)
|
34 |
threshold = inputs['input']["threshold"]
|
|
|
36 |
|
37 |
df_matrix = pd.DataFrame(matrix).T
|
38 |
df_weights = pd.DataFrame(weights).T
|
39 |
+
df_landuses = pd.DataFrame(landuses).T
|
40 |
df_matrix = df_matrix.round(0).astype(int)
|
41 |
df_weights = df_weights.round(0).astype(int)
|
42 |
+
df_landuses = df_landuses.round(0).astype(int)
|
43 |
|
44 |
|
45 |
|