Piraloco commited on
Commit
86f8cd5
·
1 Parent(s): 3b7ecbc

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +22 -19
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
- data = [rank,map,agent_picks[0],agent_picks[1],agent_picks[2],agent_picks[3],agent_picks[4]]
 
 
 
 
103
 
104
- # Preprocess the data (replace this with your specific preprocessing steps)
105
- processed_data = preprocess_data(data)
106
-
107
- # Feed the data to the model
108
- prediction = model(processed_data)
109
-
110
- # Post-process the output (replace this with your specific post-processing steps)
111
- #prediction = model(data)
112
- prediction = prediction.item()
113
- if prediction > 1:
114
- prediction -= (prediction - 1)/2
115
- prediction = 0 if prediction < 0 else prediction
116
-
117
- winrate = str(round(prediction * 100)) + '%'
118
-
119
- print(f"Calculated Winrate: {winrate}")
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