Spaces:
Sleeping
Sleeping
nastasiasnk
commited on
Commit
•
4dcad40
1
Parent(s):
d6b89fa
Update app.py
Browse files
app.py
CHANGED
@@ -19,12 +19,8 @@ def test(input_json):
|
|
19 |
inputs = json.loads(input_json.replace("'", '"'))
|
20 |
|
21 |
# Accessing input data
|
22 |
-
#ids_index = inputs['input']['ids_matrix']
|
23 |
-
|
24 |
-
#weightsNames = inputs['input']["weights_names"]
|
25 |
|
26 |
matrix = inputs['input']["matrix"]
|
27 |
-
weights = inputs['input']["weights"]
|
28 |
landuses = inputs['input']["landuse_areas"]
|
29 |
|
30 |
attributeMapperDict = inputs['input']["attributeMapperDict"]
|
@@ -36,10 +32,8 @@ def test(input_json):
|
|
36 |
threshold = float(threshold)
|
37 |
|
38 |
df_matrix = pd.DataFrame(matrix).T
|
39 |
-
df_weights = pd.DataFrame(weights).T
|
40 |
df_landuses = pd.DataFrame(landuses).T
|
41 |
df_matrix = df_matrix.round(0).astype(int)
|
42 |
-
df_weights = df_weights.round(0).astype(int)
|
43 |
df_landuses = df_landuses.round(0).astype(int)
|
44 |
|
45 |
|
@@ -58,7 +52,7 @@ def test(input_json):
|
|
58 |
# Identify and report missing indexes
|
59 |
missing_indexes = set(mask_connected) - set(valid_indexes)
|
60 |
if missing_indexes:
|
61 |
-
print(f"Error: The following indexes were not found in the DataFrame: {missing_indexes}")
|
62 |
|
63 |
# Apply the filtered mask
|
64 |
df_landuses_filtered = df_landuses.loc[valid_indexes]
|
|
|
19 |
inputs = json.loads(input_json.replace("'", '"'))
|
20 |
|
21 |
# Accessing input data
|
|
|
|
|
|
|
22 |
|
23 |
matrix = inputs['input']["matrix"]
|
|
|
24 |
landuses = inputs['input']["landuse_areas"]
|
25 |
|
26 |
attributeMapperDict = inputs['input']["attributeMapperDict"]
|
|
|
32 |
threshold = float(threshold)
|
33 |
|
34 |
df_matrix = pd.DataFrame(matrix).T
|
|
|
35 |
df_landuses = pd.DataFrame(landuses).T
|
36 |
df_matrix = df_matrix.round(0).astype(int)
|
|
|
37 |
df_landuses = df_landuses.round(0).astype(int)
|
38 |
|
39 |
|
|
|
52 |
# Identify and report missing indexes
|
53 |
missing_indexes = set(mask_connected) - set(valid_indexes)
|
54 |
if missing_indexes:
|
55 |
+
print(f"Error: The following indexes were not found in the DataFrame: {missing_indexes}, length: {len(missing_indexes)}")
|
56 |
|
57 |
# Apply the filtered mask
|
58 |
df_landuses_filtered = df_landuses.loc[valid_indexes]
|