Spaces:
Sleeping
Sleeping
nastasiasnk
commited on
Commit
•
c024d74
1
Parent(s):
0b6419d
Update app.py
Browse files
app.py
CHANGED
@@ -33,10 +33,10 @@ def test(input_json):
|
|
33 |
#multiplier_series = pd.Series(float(inputs["a_list"]), index=inputs["dataframe"].index)
|
34 |
#new_df["new column"] = float(inputs["dataframe"]).mul(multiplier_series, axis=0)
|
35 |
|
36 |
-
|
37 |
-
|
38 |
|
39 |
-
|
40 |
def computeAccessibility (DistanceMatrix,destinationWeights, alpha = 0.0038, threshold = 600):
|
41 |
|
42 |
decay_factors = np.exp(-alpha * DistanceMatrix) * (DistanceMatrix <= threshold)
|
@@ -46,16 +46,16 @@ def test(input_json):
|
|
46 |
|
47 |
#subdomainsAccessibility.drop(columns='commercial', inplace=True)
|
48 |
return subdomainsAccessibility
|
49 |
-
|
50 |
|
51 |
-
|
52 |
|
53 |
-
|
54 |
|
55 |
# Prepare the output
|
56 |
output = {
|
57 |
"list": ids_index,
|
58 |
-
"
|
59 |
}
|
60 |
|
61 |
return json.dumps(output)
|
|
|
33 |
#multiplier_series = pd.Series(float(inputs["a_list"]), index=inputs["dataframe"].index)
|
34 |
#new_df["new column"] = float(inputs["dataframe"]).mul(multiplier_series, axis=0)
|
35 |
|
36 |
+
df_matrix = pd.DataFrame(matrix).T
|
37 |
+
df_weights = pd.DataFrame(weights).T
|
38 |
|
39 |
+
|
40 |
def computeAccessibility (DistanceMatrix,destinationWeights, alpha = 0.0038, threshold = 600):
|
41 |
|
42 |
decay_factors = np.exp(-alpha * DistanceMatrix) * (DistanceMatrix <= threshold)
|
|
|
46 |
|
47 |
#subdomainsAccessibility.drop(columns='commercial', inplace=True)
|
48 |
return subdomainsAccessibility
|
49 |
+
|
50 |
|
51 |
+
subdomainsAccessibility = computeAccessibility(df_matrix,df_weights,alpha,threshold)
|
52 |
|
53 |
+
subdomainsAccessibility_dict = subdomainsAccessibility.to_dict('index')
|
54 |
|
55 |
# Prepare the output
|
56 |
output = {
|
57 |
"list": ids_index,
|
58 |
+
"subdomainsAccessibility_dict": subdomainsAccessibility_dict
|
59 |
}
|
60 |
|
61 |
return json.dumps(output)
|