nastasiasnk commited on
Commit
b65f10f
1 Parent(s): e517d5e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -8
app.py CHANGED
@@ -24,14 +24,6 @@ def test(input_json):
24
  threshold = inputs['input']["threshold"]
25
  threshold = float(threshold)
26
 
27
- #print("Parsed input keys:", inputs.keys())
28
-
29
- #print("Parsed input values:", inputs.values())
30
- #sum_list = sum(float(item) for item in inputs["a_list"])
31
- #multiplication = [-float((inputs["alpha"])) * float(item) for item in inputs["a_list"]]
32
- #new_df = pd.DataFrame(index=inputs["dataframe"].index, columns=inputs["dataframe"].columns)
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
@@ -46,12 +38,17 @@ def test(input_json):
46
  subdomainsAccessibility[col] = (decay_factors * destinationWeights[col].values).sum(axis=1)
47
 
48
  #subdomainsAccessibility.drop(columns='commercial', inplace=True)
 
49
  return subdomainsAccessibility
50
 
51
 
52
  subdomainsAccessibility = computeAccessibility(df_matrix,df_weights,alpha,threshold)
53
 
54
  subdomainsAccessibility_dict = subdomainsAccessibility.to_dict('index')
 
 
 
 
55
 
56
  # Prepare the output
57
  output = {
 
24
  threshold = inputs['input']["threshold"]
25
  threshold = float(threshold)
26
 
 
 
 
 
 
 
 
 
27
 
28
  df_matrix = pd.DataFrame(matrix).T
29
  df_weights = pd.DataFrame(weights).T
 
38
  subdomainsAccessibility[col] = (decay_factors * destinationWeights[col].values).sum(axis=1)
39
 
40
  #subdomainsAccessibility.drop(columns='commercial', inplace=True)
41
+
42
  return subdomainsAccessibility
43
 
44
 
45
  subdomainsAccessibility = computeAccessibility(df_matrix,df_weights,alpha,threshold)
46
 
47
  subdomainsAccessibility_dict = subdomainsAccessibility.to_dict('index')
48
+
49
+ for key, subdict in data['subdomainsAccessibility_dict'].items():
50
+ ordered = OrderedDict(sorted(subdict.items(), key=lambda x: int(x[0])))
51
+ subdomainsAccessibility_dict['subdomainsAccessibility_dict'][key] = ordered
52
 
53
  # Prepare the output
54
  output = {