Spaces:
Build error
Build error
phong.dao
commited on
Commit
·
670a6ea
1
Parent(s):
c0a75e2
init app
Browse files
app.py
CHANGED
@@ -3,6 +3,7 @@ import random
|
|
3 |
|
4 |
from ml.model import base_df, ml_model
|
5 |
from ml.predictor import Predictor
|
|
|
6 |
|
7 |
|
8 |
def function(team1, team2):
|
@@ -20,16 +21,20 @@ def function(team1, team2):
|
|
20 |
}
|
21 |
else:
|
22 |
return {
|
23 |
-
'
|
24 |
'probability': winner_proba
|
25 |
}
|
26 |
|
27 |
|
28 |
predictor = Predictor(base_df, ml_model)
|
|
|
|
|
29 |
iface = gr.Interface(fn=function,
|
30 |
inputs=[gr.Textbox(placeholder="Qatar"), gr.Textbox(placeholder="Ecuador")],
|
31 |
outputs="json",
|
32 |
-
title="WorldCup-Prediction \n "
|
33 |
-
"Predicting the 2022 FIFA World Cup results with Machine Learning!"
|
|
|
34 |
)
|
|
|
35 |
iface.launch()
|
|
|
3 |
|
4 |
from ml.model import base_df, ml_model
|
5 |
from ml.predictor import Predictor
|
6 |
+
from ml.utils import load_pickle
|
7 |
|
8 |
|
9 |
def function(team1, team2):
|
|
|
21 |
}
|
22 |
else:
|
23 |
return {
|
24 |
+
'winner': winner,
|
25 |
'probability': winner_proba
|
26 |
}
|
27 |
|
28 |
|
29 |
predictor = Predictor(base_df, ml_model)
|
30 |
+
examples = random.choices([x[1:3] for x in load_pickle("data/table_match.pkl")['matches']], k=20)
|
31 |
+
examples = [list(x) for x in examples]
|
32 |
iface = gr.Interface(fn=function,
|
33 |
inputs=[gr.Textbox(placeholder="Qatar"), gr.Textbox(placeholder="Ecuador")],
|
34 |
outputs="json",
|
35 |
+
title="WorldCup-Prediction \n\n "
|
36 |
+
"Predicting the 2022 FIFA World Cup results with Machine Learning!",
|
37 |
+
examples=examples
|
38 |
)
|
39 |
+
iface.queue(concurrency_count=5)
|
40 |
iface.launch()
|