Piraloco commited on
Commit
2553535
1 Parent(s): 631c6f5

Upload 2 files

Browse files
Files changed (2) hide show
  1. main.py +123 -0
  2. model.pth +3 -0
main.py ADDED
@@ -0,0 +1,123 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Import necessary libraries
2
+ import torch
3
+
4
+ # Load the model
5
+ model = torch.load("model.pth")
6
+
7
+ agents = [
8
+ 'Brimstone',
9
+ 'Viper',
10
+ 'Omen',
11
+ 'Killjoy',
12
+ 'Cypher',
13
+ 'Sova',
14
+ 'Sage',
15
+ 'Phoenix',
16
+ 'Jett',
17
+ 'Reyna',
18
+ 'Raze',
19
+ 'Breach',
20
+ 'Skye',
21
+ 'Yoru',
22
+ 'Astra',
23
+ 'KAY/O',
24
+ 'Chamber',
25
+ 'Neon',
26
+ 'Fade',
27
+ 'Harbor',
28
+ 'Gekko',
29
+ 'Deadlock',
30
+ 'Iso',
31
+ ]
32
+ maps = [
33
+ 'Ascent',
34
+ 'Bind',
35
+ 'Breeze',
36
+ 'Fracture',
37
+ 'Haven',
38
+ 'Icebox',
39
+ 'Lotus',
40
+ 'Pearl',
41
+ 'Split',
42
+ 'Sunset',
43
+ ]
44
+ ranks = [
45
+ 'Iron 1',
46
+ 'Iron 2',
47
+ 'Iron 3',
48
+ 'Bronze 1',
49
+ 'Bronze 2',
50
+ 'Bronze 3',
51
+ 'Silver 1',
52
+ 'Silver 2',
53
+ 'Silver 3',
54
+ 'Gold 1',
55
+ 'Gold 2',
56
+ 'Gold 3',
57
+ 'Platinum 1',
58
+ 'Platinum 2',
59
+ 'Platinum 3',
60
+ 'Diamond 1',
61
+ 'Diamond 2',
62
+ 'Diamond 3',
63
+ 'Ascendant 1',
64
+ 'Ascendant 2',
65
+ 'Ascendant 3',
66
+ 'Immortal 1',
67
+ 'Immortal 2',
68
+ 'Immortal 3',
69
+ 'Radiant',
70
+ ]
71
+
72
+ def preprocess_data(data):
73
+ # Preprocess the data (replace this with your specific preprocessing steps)
74
+ processed_data = ranks.index(processed_data[0])
75
+ processed_data[1] = maps.index(processed_data[1])
76
+ processed_data[2:7] = [agents.index(agent) for agent in processed_data[2:7]]
77
+
78
+ inputs = torch.tensor(processed_data, dtype = torch.float32)
79
+
80
+ return processed_data
81
+
82
+ # Define your prediction function
83
+ def make_prediction(data):
84
+ # Preprocess the data (replace this with your specific preprocessing steps)
85
+ processed_data = preprocess_data(data)
86
+
87
+ # Feed the data to the model
88
+ output = model(processed_data)
89
+
90
+ # Post-process the output (replace this with your specific post-processing steps)
91
+ prediction = model(data)
92
+ prediction = prediction.item()
93
+ prediction = 0 if prediction < 0 else prediction
94
+
95
+ winrate = str(round(prediction * 100)) + '%'
96
+
97
+ print(f"Calculated Winrate: {winrate}")
98
+
99
+ return winrate
100
+
101
+ # Example usage
102
+ #data = ... # your input data
103
+ #prediction = predict(data)
104
+
105
+ #print(f"Prediction: {prediction}")
106
+
107
+ import gradio as gr
108
+
109
+ # Create Gradio interface with relevant inputs
110
+ interface = gr.Interface(
111
+ fn=make_prediction,
112
+ inputs=[
113
+ # Input for rank
114
+ gr.Dropdown(label="Rank", choices=ranks, default=ranks[0]),
115
+ # Input for map
116
+ gr.Dropdown(label="Map", choices=maps, default=maps[0]),
117
+ # Input for agents
118
+ gr.MultiSelect(label="Agent Picks (1-5)", choices=agents, default=[agents[0]]),
119
+ ],
120
+ outputs="text",
121
+ )
122
+
123
+ interface.launch()
model.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6b24468490743bdc701e980f21a54591e2bebc53c0091d49d1093d32c92a946a
3
+ size 39604