serJD commited on
Commit
cf9dc09
1 Parent(s): 8451ac2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -27,7 +27,7 @@ def huff_model_probability(df_distances, df_attractiveness, alpha, beta, df_popu
27
 
28
  numerator = (attractiveness_term * distance_term).multiply(adjusted_population, axis=0)
29
  denominator = numerator.sum(axis=1)
30
- probabilities = numerator.div(denominator, axis=0)
31
 
32
  return probabilities, adjustment_factors
33
 
@@ -75,8 +75,8 @@ def app_function(input_json):
75
 
76
  # Prepare the output
77
  output = {
78
- "probabilities": probabilities.to_json(orient='split'),
79
- "adjustment_factors": adjustment_factors.to_json(orient='split')
80
  }
81
 
82
  return json.dumps(output)
 
27
 
28
  numerator = (attractiveness_term * distance_term).multiply(adjusted_population, axis=0)
29
  denominator = numerator.sum(axis=1)
30
+ probabilities = numerator.div(denominator, axis=0).fillna(0)
31
 
32
  return probabilities, adjustment_factors
33
 
 
75
 
76
  # Prepare the output
77
  output = {
78
+ "probabilities": probabilities
79
+ "adjustment_factors": adjustment_factors
80
  }
81
 
82
  return json.dumps(output)