Update app.py
Browse files
app.py
CHANGED
|
@@ -99,26 +99,29 @@ def preprocess_data(data):
|
|
| 99 |
|
| 100 |
# Define your prediction function
|
| 101 |
def make_prediction(rank,map,agent_picks):
|
| 102 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 103 |
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
|
| 111 |
-
|
| 112 |
-
|
| 113 |
-
|
| 114 |
-
|
| 115 |
-
|
| 116 |
-
|
| 117 |
-
|
| 118 |
-
|
| 119 |
-
|
| 120 |
-
|
| 121 |
-
return winrate
|
| 122 |
|
| 123 |
# Example usage
|
| 124 |
#data = ... # your input data
|
|
|
|
| 99 |
|
| 100 |
# Define your prediction function
|
| 101 |
def make_prediction(rank,map,agent_picks):
|
| 102 |
+
try:
|
| 103 |
+
data = [rank,map,agent_picks[0],agent_picks[1],agent_picks[2],agent_picks[3],agent_picks[4]]
|
| 104 |
+
|
| 105 |
+
# Preprocess the data (replace this with your specific preprocessing steps)
|
| 106 |
+
processed_data = preprocess_data(data)
|
| 107 |
|
| 108 |
+
# Feed the data to the model
|
| 109 |
+
prediction = model(processed_data)
|
| 110 |
+
|
| 111 |
+
# Post-process the output (replace this with your specific post-processing steps)
|
| 112 |
+
#prediction = model(data)
|
| 113 |
+
prediction = prediction.item()
|
| 114 |
+
if prediction > 1:
|
| 115 |
+
prediction -= (prediction - 1)/2
|
| 116 |
+
prediction = 0 if prediction < 0 else prediction
|
| 117 |
+
|
| 118 |
+
winrate = str(round(prediction * 100)) + '%'
|
| 119 |
+
|
| 120 |
+
print(f"Calculated Winrate: {winrate}")
|
| 121 |
+
|
| 122 |
+
return winrate
|
| 123 |
+
except:
|
| 124 |
+
return 'Error, you probably forgot to fill out a component'
|
|
|
|
| 125 |
|
| 126 |
# Example usage
|
| 127 |
#data = ... # your input data
|