Spaces:
Sleeping
Sleeping
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
import pickle
|
3 |
+
import numpy as np
|
4 |
+
|
5 |
+
def make_prediction(placement, LargestTrait, MaxTraitCount, Itemcount, Fivecost, Fourcost, Threecost, Twocost, Onecost):
|
6 |
+
with open("modelforweb.pkl", "rb") as f:
|
7 |
+
clf = pickle.load(f)
|
8 |
+
preds = clf.predict([[placement, LargestTrait, MaxTraitCount, Itemcount, Fivecost, Fourcost, Threecost, Twocost, Onecost]])
|
9 |
+
pred = np.round(preds)
|
10 |
+
return pred
|
11 |
+
|
12 |
+
#Create the input component for Gradio since we are expecting 4 inputs
|
13 |
+
|
14 |
+
placement_input = gr.Number(label = "Enter your placement")
|
15 |
+
LargestTrait_input = gr.Number(label= "Enter your largest active trait number")
|
16 |
+
MaxTraitCount_input = gr.Number(label = "Enter your all active trait sum")
|
17 |
+
Itemcount_input = gr.Number(label = "Enter your items number")
|
18 |
+
Fivecost_input = gr.Number(label = "Enter your five cost champs number")
|
19 |
+
Fourcost_input = gr.Number(label= "Enter your four cost champs number")
|
20 |
+
Threecost_input = gr.Number(label = "Enter your three cost champs number")
|
21 |
+
Twocost_input = gr.Number(label = "Enter your two cost champs number")
|
22 |
+
Onecost_input = gr.Number(label = "Enter your one cost champs number")
|
23 |
+
# We create the output
|
24 |
+
output = gr.Number(label = "Predicted level")
|
25 |
+
|
26 |
+
|
27 |
+
app = gr.Interface(fn = make_prediction, inputs=[placement_input, LargestTrait_input, MaxTraitCount_input, Itemcount_input, Fivecost_input, Fourcost_input, Threecost_input, Twocost_input, Onecost_input], outputs=output)
|
28 |
+
app.launch()
|