Update app.py
Browse files
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 |
-
|
|
|
|
| 78 |
|
| 79 |
# Define the Gradio interface with a single JSON input
|
| 80 |
iface = gr.Interface(
|
| 81 |
fn=app_function,
|
| 82 |
-
inputs=gr.
|
| 83 |
-
outputs="
|
| 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 |
|