Spaces:
Build error
Build error
Commit ·
2333d87
1
Parent(s): 12401d0
Refactor check_route function: Update fuel unit and default selections
Browse files
app.py
CHANGED
|
@@ -60,8 +60,8 @@ def check_route(airport_selections, aircraft_type):
|
|
| 60 |
<p>{" -> ".join(optimal_route) + f" -> {optimal_route[0]}"}</p>
|
| 61 |
<h3>Total Round Trip Distance</h3>
|
| 62 |
<p>{optimal_distance} km</p>
|
| 63 |
-
<h3>Round Trip Fuel Required (
|
| 64 |
-
<p>{feasibility_result["Total Fuel Required (kg)"]}</p>
|
| 65 |
<h3>Round Trip Flight Time (hrs)</h3>
|
| 66 |
<p>{feasibility_result["Total Flight Time (hrs)"]}</p>
|
| 67 |
<h3>Can Fly Entire Route</h3>
|
|
@@ -90,8 +90,8 @@ with gr.Blocks(theme=gr.themes.Default()) as demo:
|
|
| 90 |
# Place components in two columns for results and map
|
| 91 |
with gr.Row():
|
| 92 |
with gr.Column():
|
| 93 |
-
airport_selector = gr.Dropdown(airport_options, multiselect=True, label="Select Airports (IATA - Name)")
|
| 94 |
-
aircraft_selector = gr.Dropdown(aircraft_options, label="Select Aircraft Type")
|
| 95 |
check_button = gr.Button("Check Route Feasibility")
|
| 96 |
result_output = gr.HTML(label="Feasibility Result (Route, Fuel, Refueling Info)")
|
| 97 |
|
|
|
|
| 60 |
<p>{" -> ".join(optimal_route) + f" -> {optimal_route[0]}"}</p>
|
| 61 |
<h3>Total Round Trip Distance</h3>
|
| 62 |
<p>{optimal_distance} km</p>
|
| 63 |
+
<h3>Round Trip Fuel Required (Tonnes)</h3>
|
| 64 |
+
<p>{round(feasibility_result["Total Fuel Required (kg)"]/1000,2)}</p>
|
| 65 |
<h3>Round Trip Flight Time (hrs)</h3>
|
| 66 |
<p>{feasibility_result["Total Flight Time (hrs)"]}</p>
|
| 67 |
<h3>Can Fly Entire Route</h3>
|
|
|
|
| 90 |
# Place components in two columns for results and map
|
| 91 |
with gr.Row():
|
| 92 |
with gr.Column():
|
| 93 |
+
airport_selector = gr.Dropdown(airport_options, multiselect=True, label="Select Airports (IATA - Name)", value=["JFK - John F Kennedy Intl - United States", "LHR - Heathrow - United Kingdom", "SIN - Changi Intl - Singapore"])
|
| 94 |
+
aircraft_selector = gr.Dropdown(aircraft_options, label="Select Aircraft Type", value="Airbus A350-900")
|
| 95 |
check_button = gr.Button("Check Route Feasibility")
|
| 96 |
result_output = gr.HTML(label="Feasibility Result (Route, Fuel, Refueling Info)")
|
| 97 |
|