Ziyou Li commited on
Commit
b2d6c75
·
1 Parent(s): a338591

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -15
app.py CHANGED
@@ -8,21 +8,6 @@ import json
8
  import dateutil.parser as dp
9
  import pandas as pd
10
 
11
- title = "Stoclholm Highway E4 Real Time Traffic Prediction"
12
- description = "Stockholm E4 (59°23'44.7"" N 17°59'00.4""E) highway real time traffic prediction"
13
-
14
- inputs = [gr.Dataframe(row_count = (1, "fixed"), col_count=(7,"fixed"),
15
- headers=["referenceTime", "t", "ws", "prec1h", "fesn1h", "vis", "confidence"],
16
- # datatype=["timestamp", "float", "float", "float", "float", "float"],
17
- label="Input Data", interactive=1)]
18
-
19
- outputs = [gr.Dataframe(row_count = (1, "fixed"), col_count=(1, "fixed"), label="Predictions", headers=["Congestion Level"])]
20
-
21
- model = joblib.load("./traffic_model.pkl")
22
-
23
-
24
- def infer(input_dataframe):
25
- return pd.DataFrame(model.predict(input_dataframe))
26
 
27
  def get_row():
28
  response_tomtom = requests.get(
@@ -65,4 +50,19 @@ def get_row():
65
 
66
  return row
67
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
68
  gr.Interface(fn = infer, inputs = inputs, outputs = outputs, title=title, description=description, examples=[get_row()]).launch()
 
8
  import dateutil.parser as dp
9
  import pandas as pd
10
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11
 
12
  def get_row():
13
  response_tomtom = requests.get(
 
50
 
51
  return row
52
 
53
+ model = joblib.load("./traffic_model.pkl")
54
+
55
+ def infer(input_dataframe):
56
+ return pd.DataFrame(model.predict(input_dataframe))
57
+
58
+ title = "Stoclholm Highway E4 Real Time Traffic Prediction"
59
+ description = "Stockholm E4 (59°23'44.7"" N 17°59'00.4""E) highway real time traffic prediction"
60
+
61
+ inputs = [gr.Dataframe(row_count = (1, "fixed"), col_count=(7,"fixed"),
62
+ headers=["referenceTime", "t", "ws", "prec1h", "fesn1h", "vis", "confidence"],
63
+ # datatype=["timestamp", "float", "float", "float", "float", "float"],
64
+ label="Input Data", interactive=1)]
65
+
66
+ outputs = [gr.Dataframe(row_count = (1, "fixed"), col_count=(1, "fixed"), label="Predictions", headers=["Congestion Level"])]
67
+
68
  gr.Interface(fn = infer, inputs = inputs, outputs = outputs, title=title, description=description, examples=[get_row()]).launch()