Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -6,6 +6,11 @@ import pandas as pd
|
|
| 6 |
with open("xgboost_trip_delay_model.pkl", "rb") as f:
|
| 7 |
model = pickle.load(f)
|
| 8 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
# Define the prediction function for Gradio
|
| 10 |
def predict_bus_delay(route_id, trip_direction, speed, trip_delay_y, hour, minute, last_stop_arrival_seconds):
|
| 11 |
data = pd.DataFrame({
|
|
@@ -28,7 +33,7 @@ def predict_bus_delay(route_id, trip_direction, speed, trip_delay_y, hour, minut
|
|
| 28 |
interface = gr.Interface(
|
| 29 |
fn=predict_bus_delay,
|
| 30 |
inputs=[
|
| 31 |
-
gr.
|
| 32 |
gr.Dropdown(label="Direction", choices=["UP", "DN"]),
|
| 33 |
gr.Number(label="Speed"),
|
| 34 |
gr.Number(label="Previous Stop Delay"),
|
|
|
|
| 6 |
with open("xgboost_trip_delay_model.pkl", "rb") as f:
|
| 7 |
model = pickle.load(f)
|
| 8 |
|
| 9 |
+
# List of available routes
|
| 10 |
+
routes = [
|
| 11 |
+
"254U", "13U", "16D", "116BRU", "716U", "403D", "17AEU", "18U", "14U", "116BRD", "706D", "14D", "213D", "207ED", "716D", "706U", "15CU", "403U", "118D", "16U", "137JU", "402U", "20D", "11U", "103SD", "658U", "12U", "02U", "205GU", "103VD", "137JD", "305U", "117U", "108RD", "105D", "136U", "112D", "305D", "108RU", "12D", "22D", "20U", "19U", "204D", "136D", "658D", "112U", "504D", "17AD", "21D", "504U", "107JU", "106RU", "216KD", "11D", "117D", "104U", "22U", "104D", "506U", "106RD", "21U", "105U", "17AU", "216BD", "116RD", "207EU", "116RU", "402D", "18D", "118U", "903U", "01U", "206D", "206U", "903D"
|
| 12 |
+
]
|
| 13 |
+
|
| 14 |
# Define the prediction function for Gradio
|
| 15 |
def predict_bus_delay(route_id, trip_direction, speed, trip_delay_y, hour, minute, last_stop_arrival_seconds):
|
| 16 |
data = pd.DataFrame({
|
|
|
|
| 33 |
interface = gr.Interface(
|
| 34 |
fn=predict_bus_delay,
|
| 35 |
inputs=[
|
| 36 |
+
gr.Dropdown(label="Route ID", choices=routes),
|
| 37 |
gr.Dropdown(label="Direction", choices=["UP", "DN"]),
|
| 38 |
gr.Number(label="Speed"),
|
| 39 |
gr.Number(label="Previous Stop Delay"),
|