Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -6,7 +6,15 @@ import numpy as np
|
|
6 |
model = joblib.load("tiebreak_model.pkl")
|
7 |
|
8 |
# Função para realizar a previsão
|
9 |
-
def predict_tiebreak(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
# Calculando as features
|
11 |
odds_ratio = win_odds / loser_odds
|
12 |
log_odds_w = np.log(win_odds)
|
@@ -24,8 +32,11 @@ def predict_tiebreak(win_odds, loser_odds):
|
|
24 |
# Calculando a odds mínima
|
25 |
odds_minima = 1 / prob
|
26 |
|
27 |
-
#
|
28 |
-
|
|
|
|
|
|
|
29 |
|
30 |
# Interface Gradio
|
31 |
inputs = [gr.Number(label="Win Odds"), gr.Number(label="Loser Odds")]
|
|
|
6 |
model = joblib.load("tiebreak_model.pkl")
|
7 |
|
8 |
# Função para realizar a previsão
|
9 |
+
def predict_tiebreak(win_odds_input, loser_odds_input):
|
10 |
+
# Converter vírgulas para pontos caso necessário
|
11 |
+
win_odds_input = str(win_odds_input).replace(',', '.')
|
12 |
+
loser_odds_input = str(loser_odds_input).replace(',', '.')
|
13 |
+
|
14 |
+
# Converter para float
|
15 |
+
win_odds = float(win_odds_input)
|
16 |
+
loser_odds = float(loser_odds_input)
|
17 |
+
|
18 |
# Calculando as features
|
19 |
odds_ratio = win_odds / loser_odds
|
20 |
log_odds_w = np.log(win_odds)
|
|
|
32 |
# Calculando a odds mínima
|
33 |
odds_minima = 1 / prob
|
34 |
|
35 |
+
# Formatando a probabilidade para percentual com duas casas decimais
|
36 |
+
prob_percent = f"{round(prob * 100, 2)}%"
|
37 |
+
|
38 |
+
# Retornando os valores
|
39 |
+
return prob_percent, round(odds_minima, 2)
|
40 |
|
41 |
# Interface Gradio
|
42 |
inputs = [gr.Number(label="Win Odds"), gr.Number(label="Loser Odds")]
|