Ziyou Li commited on
Commit
8d99195
·
1 Parent(s): 6e3e359

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -1
app.py CHANGED
@@ -62,7 +62,14 @@ def infer(input_dataframe):
62
  serie = input_dataframe["referenceTime"]
63
  ts = dp.parse(serie.iloc[0]).timestamp()
64
  input_dataframe["referenceTime"] = ts
65
- return pd.DataFrame(model.predict(input_dataframe)).clip(0, 1)
 
 
 
 
 
 
 
66
 
67
  title = "Stoclholm Highway E4 Real Time Traffic Prediction"
68
  description = "Stockholm E4 (59°23'44.7"" N 17°59'00.4""E) highway real time traffic prediction"
 
62
  serie = input_dataframe["referenceTime"]
63
  ts = dp.parse(serie.iloc[0]).timestamp()
64
  input_dataframe["referenceTime"] = ts
65
+ res = pd.DataFrame(model.predict(input_dataframe)).clip(0, 1)
66
+ if res > 0.8:
67
+ status = "Smooth Traffic on E4"
68
+ elif res > 0.5:
69
+ status = "Slight congestion on E4"
70
+ else:
71
+ status = "Total congestion on E4"
72
+ return res, status
73
 
74
  title = "Stoclholm Highway E4 Real Time Traffic Prediction"
75
  description = "Stockholm E4 (59°23'44.7"" N 17°59'00.4""E) highway real time traffic prediction"