serJD commited on
Commit
b1ead6c
1 Parent(s): fa7b8b5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -3
app.py CHANGED
@@ -74,13 +74,14 @@ def app_function(input_json):
74
  result = dynamic_huff_model(df_distances, df_attractiveness, alpha, beta, df_capacity, df_population, iterations, crowding_threshold)
75
 
76
  # Convert the result DataFrame to a CSV string for Gradio output
77
- return result.to_csv(index=False)
 
78
 
79
  # Define the Gradio interface with a single JSON input
80
  iface = gr.Interface(
81
  fn=app_function,
82
- inputs=gr.inputs.Textbox(label="Input JSON", lines=20, placeholder="Enter JSON with all parameters here..."),
83
- outputs="file",
84
  title="Dynamic Huff Model"
85
  )
86
 
 
74
  result = dynamic_huff_model(df_distances, df_attractiveness, alpha, beta, df_capacity, df_population, iterations, crowding_threshold)
75
 
76
  # Convert the result DataFrame to a CSV string for Gradio output
77
+ result_json = result.to_json(orient='split')
78
+ return json.loads(result_json)
79
 
80
  # Define the Gradio interface with a single JSON input
81
  iface = gr.Interface(
82
  fn=app_function,
83
+ inputs=gr.Textbox(label="Input JSON", lines=20, placeholder="Enter JSON with all parameters here..."),
84
+ outputs=gr.JSON(label="Output JSON"),
85
  title="Dynamic Huff Model"
86
  )
87