Chenzhou commited on
Commit
6fedaa7
1 Parent(s): b0bf4d9

Upload 2 files

Browse files
Files changed (2) hide show
  1. app.py +23 -0
  2. requirements.txt +5 -0
app.py ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import sklearn
2
+ import gradio as gr
3
+ import joblib
4
+ import pandas as pd
5
+ import datasets
6
+
7
+ title = "Stoclholm Highway E4 Real Time Traffic Prediction"
8
+ description = "Stockholm E4 (59°23'44.7"" N 17°59'00.4""E) highway real time traffic prediction, updated in every hour"
9
+
10
+ inputs = [gr.Dataframe(row_count = (1, "fixed"), col_count=(1,"fixed"), label="Input Data", interactive=1)]
11
+
12
+ outputs = [gr.Dataframe(row_count = (1, "fixed"), col_count=(1, "fixed"), label="Predictions", headers=["Congestion Level"])]
13
+
14
+ model = joblib.load("tilos/Traffic_Prediction/tree/main/traffic_model.pkl")
15
+
16
+ # we will give our dataframe as example
17
+ #df = datasets.load_dataset("merve/supersoaker-failures")
18
+ #df = df["train"].to_pandas()
19
+
20
+ def infer(input_dataframe):
21
+ return pd.DataFrame(model.predict(input_dataframe))
22
+
23
+ gr.Interface(fn = infer, inputs = inputs, outputs = outputs).launch()
requirements.txt ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ sklearn
2
+ gradio
3
+ joblib
4
+ pandas
5
+ datasets