Spaces:
Runtime error
Runtime error
Ziyou Li
commited on
Commit
·
ddcb6be
1
Parent(s):
1071eb4
Update app.py
Browse files
app.py
CHANGED
@@ -9,6 +9,7 @@ import dateutil.parser as dp
|
|
9 |
import pandas as pd
|
10 |
from huggingface_hub import hf_hub_url, cached_download
|
11 |
import time
|
|
|
12 |
|
13 |
def get_row():
|
14 |
response_tomtom = requests.get(
|
@@ -38,7 +39,7 @@ def get_row():
|
|
38 |
vis = json_response_smhi["timeSeries"][0]["parameters"][9]["values"][0] # Visibility
|
39 |
|
40 |
# Use current time
|
41 |
-
referenceTime =
|
42 |
|
43 |
row ={"referenceTime": referenceTime,
|
44 |
"temperature": t,
|
@@ -58,7 +59,7 @@ model = joblib.load(cached_download(
|
|
58 |
))
|
59 |
|
60 |
def infer(input_dataframe):
|
61 |
-
input_dataframe["referenceTime"] =
|
62 |
return pd.DataFrame(model.predict(input_dataframe)).clip(0, 1)
|
63 |
|
64 |
title = "Stoclholm Highway E4 Real Time Traffic Prediction"
|
|
|
9 |
import pandas as pd
|
10 |
from huggingface_hub import hf_hub_url, cached_download
|
11 |
import time
|
12 |
+
import datetime as datetime
|
13 |
|
14 |
def get_row():
|
15 |
response_tomtom = requests.get(
|
|
|
39 |
vis = json_response_smhi["timeSeries"][0]["parameters"][9]["values"][0] # Visibility
|
40 |
|
41 |
# Use current time
|
42 |
+
referenceTime = datetime.fromtimestamp(time.time())
|
43 |
|
44 |
row ={"referenceTime": referenceTime,
|
45 |
"temperature": t,
|
|
|
59 |
))
|
60 |
|
61 |
def infer(input_dataframe):
|
62 |
+
input_dataframe["referenceTime"] = datetime.timestamp(input_dataframe["referenceTime"])
|
63 |
return pd.DataFrame(model.predict(input_dataframe)).clip(0, 1)
|
64 |
|
65 |
title = "Stoclholm Highway E4 Real Time Traffic Prediction"
|