Matthew Rice commited on
Commit
72c830a
1 Parent(s): e15571e

Added stats gradio app

Browse files
Files changed (1) hide show
  1. app_data.py +24 -0
app_data.py ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from fastai.tabular.all import *
2
+ import gradio as gr
3
+
4
+ # path = Path()
5
+ df = pd.read_csv("rookie_year.csv")
6
+ learn = load_learner("export.pkl")
7
+
8
+ def predict2(data):
9
+ row = data.drop("Name", axis=1).astype(float)
10
+ row["Cmp"] = row["Att"].item() * row["Cmp%"].item()
11
+ pred_row, clas, probs = learn.predict(row.iloc[0])
12
+ prediction = pred_row.decode()["Tier"].item()
13
+ return prediction
14
+
15
+
16
+ demo2 = gr.Interface(fn=predict2,
17
+ inputs=gr.Dataframe(row_count=1, col_count=8, headers=[x for x in columns if x not in ["Cmp", "G", "GS"]], label="Rookie Year Stats"),
18
+ outputs=gr.Textbox(label="Prediction"),
19
+ title="Rookie QB Career Prediction (Stats)",
20
+ description="Given stats of a presumed rookie QB, predict their career tier. Uses data from https:\/\/www.pro-football-reference.com. Tiers based on PFR Approximate Value.",
21
+ article="See more details at https://github.com/mhrice/Rookie-QB-Predictions"
22
+ )
23
+
24
+ demo2.launch()