Spaces:
Sleeping
Sleeping
File size: 13,594 Bytes
3231b63 1579776 3231b63 03fec6a 3231b63 29c9c90 3231b63 390b694 3231b63 fc2b782 3231b63 fc2b782 3231b63 390b694 3231b63 fc2b782 3231b63 fc2b782 3231b63 fc2b782 3231b63 fc2b782 3231b63 390b694 3231b63 4697c91 29c9c90 1579776 29c9c90 3231b63 29c9c90 3231b63 a2e9146 3231b63 6d0c403 3231b63 27a162f 3231b63 246fd4b 3231b63 4ea0b49 3231b63 4697c91 9704cc0 3231b63 fc2b782 3231b63 fc2b782 3231b63 fc2b782 3231b63 3bd66b1 3231b63 ff0bca6 3231b63 410cd51 3231b63 fc2b782 3231b63 fc2b782 3231b63 c96b7a4 3231b63 fc2b782 3231b63 7d941cf 3231b63 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 |
<!DOCTYPE html>
<html>
<head>
<link rel="shortcut icon" type="image/x-icon" href="https://images.squarespace-cdn.com/content/v1/64790f5777b5d772678cce83/6d71eaee-f825-4324-be9b-2def32469eac/favicon.ico?format=100w">
<title>MARCI</title>
</head>
<style>
body {
margin: 0;
background-color: black;
font-family: 'Helvetica';
justify-content: center;
text-align: center;
padding: 5%;
padding-left: 10%;
padding-right: 10%;
padding-top: 2%;
}
p {
color: #f2f2f2;
}
h1 {
color: #f2f2f2;
margin-top: 40px;
margin-bottom: 10px;
}
h2 {
margin-top: 0px;
color: #f2f2f2;
}
h3 {
color: #f2f2f2;
margin: 0px;
}
table {
margin-top: 20px;
width: 100%;
border-collapse: collapse;
text-align: center;
}
th, td {
color: #f2f2f2;
border: 1px solid black;
text-align: center;
padding: 8px;
}
th {
background-color: black;
}
tr {
background-color: black;
}
tr:nth-child(even) {
background-color: rgb(10, 10, 5);
}
td img {
display: block;
margin: auto;
}
input[type="text"] {
font-size: 12pt;
width: 80px;
height: 30px;
text-align: center;
background-color: transparent;
color: #f2f2f2;
border: 1px solid #464646;
}
button {
font-size: 12pt;
background-color: rgb(61, 61, 61);
color: #ffffff;
padding: 10px 20px;
border: none;
border-radius: 5px;
margin-top: 40px;
width: 100%;
transition: all 0.3s ease;
}
button:hover {
color: rgb(0, 0, 0);
background-color: rgb(255, 255, 255);
}
.winner-wrapper {
position: relative;
width: 100%;
text-align: center;
display: flex;
justify-content: center;
align-items: center;
}
.winner-image {
height: auto;
margin: 0;
transition: opacity 0.3s ease;
}
.overlay {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.8);
color: white;
display: flex;
justify-content: center;
align-items: center;
opacity: 0;
transition: opacity 0.3s ease;
}
.winner-wrapper:hover .overlay {
opacity: 1;
}
.over-under-wrapper {
position: relative;
width: 100%;
height: 50px;
display: flex;
align-items: center;
justify-content: center;
transition: opacity 0.3s ease;
}
.over-under-text {
display: inline-block;
margin: 0;
margin-right: 2px;
font-weight: bold;
}
.over {
color: green;
}
.under {
color: red;
}
.na {
color: white;
}
.over-under-wrapper .overlay {
position: absolute;
top: 0;
left: 0;
width: 100%;
background-color: rgba(0, 0, 0, 0.8);
color: white;
display: flex;
justify-content: center;
align-items: center;
opacity: 0;
transition: opacity 0.3s ease;
}
.over-under-wrapper:hover .overlay {
opacity: 1;
}
.hidden {
opacity: 0;
}
.section-container {
display: flex;
justify-content: space-between;
}
.section {
padding: 30px;
text-align: left;
border-style: solid;
border-width: 1px;
border-color: rgb(61, 61, 61);
width: 48%;
}
.content {
width: 100%;
}
.content img {
width: 100%;
height: auto;
margin-top: 20px;
margin-bottom: 20px;
}
.divider {
border: 0;
height: 1px;
background: rgb(61, 61, 61);
margin-top: 50px;
margin-bottom: 50px;
}
.label {
color: rgb(114, 114, 114);
}
.info {
color: white;
}
a {
color: white;
}
.scroll-banner {
position: fixed;
top: 0;
left: 0;
width: 100%;
z-index: 999;
width: 100%;
display: flex;
align-items: center;
height: 30px;
background-color: green;
overflow: hidden;
}
.scroll-text {
font-family: 'Helvetica';
color: white;
display: inline-block;
animation: scrolling 10s linear infinite;
white-space: nowrap;
}
@keyframes scrolling {
0% { transform: translateX(100vw); }
100% { transform: translateX(-100%); }
}
</style>
<div class="scroll-banner">
<div class="scroll-text">
Predictions will begin at the conclusion of Week 1. Bet at your own risk. Know your limits. And most importantly, have fun!
</div>
</div>
<body>
<h1>M A R C I</h1>
<div class="info">
<span class="label"><i>"Moore's Algorithm for Risky Capital Investments"</i></span><br><br>
<span class="label">Winners:</span> 0-0<br>
<span class="label">Over/Unders:</span> 0-0<br><br>
<table id="gameTable">
<tr>
<th>Date</th>
<th>Away Team</th>
<th>Home Team</th>
<th>Over/Under Line</th>
<th>Predicted Winner</th>
<th>Predicted Over/Under</th>
</tr>
</table>
<button id="submitButton">
Predict
</button>
<hr class="divider">
<div id="modelDetails">
<h2>Model Details</h2>
<div class="section-container">
<div class="section">
<h3>Moneyline</h3>
<div class="info"></h3><span class="label">Test Accuracy:</span> 71.4%<br></div>
<div class="content">
<img src="/Static/xgboost_ML_no_odds_71.4%25_dark.png" alt="Moneyline Model">
<div class="info">
<span class="label">Model:</span> XGBoost<br>
<span class="label">Train/Test Split:</span> 1782/199<br>
<span class="label">Max Depth:</span> 2<br>
<span class="label">Learning Rate:</span> 0.01<br>
<span class="label">Epochs:</span> 500
</div>
</div>
</div>
<div class="section">
<h3>Over/Under</h3>
<div class="content">
<div class="info"></h3><span class="label">Test Accuracy:</span> 59.8%<br></div>
<img src="/Static/xgboost_OU_no_odds_59.8%25_dark.png" alt="Over/Under Model">
<div class="info">
<span class="label">Model:</span> XGBoost<br>
<span class="label">Train/Test Split:</span> 1782/199<br>
<span class="label">Max Depth:</span> 6<br>
<span class="label">Learning Rate:</span> 0.05<br>
<span class="label">Epochs:</span> 300
</div>
</div>
</div>
</div>
</div>
<p>π€<a href="https://huggingface.co/spaces/BraydenMoore/MARCI-NFL-Betting/tree/main">See the Code</a></p>
<script>
async function fetchGames() {
const response = await fetch('/get_games');
const pulled_games = await response.json();
const table = document.getElementById('gameTable');
const columns = ['Date','Away Team', 'Home Team'];
pulled_games.forEach((game) => {
const row = table.insertRow(-1);
columns.forEach((column) => {
const cell = row.insertCell(-1);
if (column === 'Away Team' || column === 'Home Team') {
const img = document.createElement('img');
img.src = `/Static/${game[column]}.webp`;
img.alt = game[column];
img.width = 50;
cell.appendChild(img);
} else {
cell.textContent = game[column];
}
});
for (let i = 0; i < 3; i++) {
const cell = row.insertCell(-1);
if (i<1) {
const input = document.createElement('input');
input.type = 'text';
cell.appendChild(input);
}
}
});
}
fetchGames();
function submitData() {
const table = document.getElementById('gameTable');
const rows = table.querySelectorAll('tr');
const games = [];
rows.forEach((row, index) => {
if (index === 0) return;
const cells = row.querySelectorAll('td');
const game = {};
game.Date = cells[0].textContent;
game.AwayTeam = cells[1].querySelector('img').alt;
game.HomeTeam = cells[2].querySelector('img').alt;
game.OverUnderLine = cells[3].querySelector('input').value;
game.rowIndex = index - 1;
games.push(game);
});
fetch('/submit_games', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify(games),
})
.then(response => response.json())
.then(data => {
if (data.moneylines && data.over_unders) {
const table = document.getElementById('gameTable');
const rows = table.querySelectorAll('tr');
data.moneylines.forEach((moneyline, index) => {
const row = rows[parseInt(moneyline.rowIndex) + 1];
const winnerCell = row.cells[row.cells.length - 2];
winnerCell.innerHTML = '';
const wrapperDiv = document.createElement('div');
wrapperDiv.className = 'winner-wrapper';
const winnerImg = document.createElement('img');
winnerImg.src = `/Static/${moneyline.Winner}.webp`;
winnerImg.alt = moneyline.Winner;
winnerImg.width = 50;
winnerImg.className = 'winner-image hidden';
wrapperDiv.appendChild(winnerImg);
const winnerEmojiDiv = document.createElement('div');
winnerEmojiDiv.className = 'emoji';
if (moneyline.Winner === moneyline.Result) {
winnerEmojiDiv.textContent = 'β
';
} else {
winnerEmojiDiv.textContent = 'β';
}
if (moneyline.Result === 'N/A') {
winnerEmojiDiv.textContent = '';
}
wrapperDiv.appendChild(winnerEmojiDiv);
setTimeout(() => {
winnerImg.classList.remove('hidden');
}, 10);
const winnerOverlayDiv = document.createElement('div');
winnerOverlayDiv.className = 'overlay';
winnerOverlayDiv.textContent = `${Math.round(moneyline.Probabilities[0] * 100)}%`;
wrapperDiv.appendChild(winnerOverlayDiv);
winnerCell.appendChild(wrapperDiv);
const overUnderCell = row.cells[row.cells.length - 1];
overUnderCell.innerHTML = '';
const overUnderDiv = document.createElement('div');
overUnderDiv.className = 'over-under-wrapper hidden';
const textDiv = document.createElement('div');
textDiv.className = 'over-under-text';
textDiv.textContent = data.over_unders[index]['Over/Under'];
if (textDiv.textContent === 'Over') {
overUnderDiv.className += ' over';
} else if (textDiv.textContent === 'Under') {
overUnderDiv.className += ' under';
} else {
overUnderDiv.className += ' na';
}
overUnderDiv.appendChild(textDiv);
const overEmojiDiv = document.createElement('div');
overEmojiDiv.className = 'emoji';
if (data.over_unders[index]['Over/Under'] === data.over_unders[index]['Result']) {
overEmojiDiv.textContent = 'β
';
} else {
overEmojiDiv.textContent = 'β';
}
if (data.over_unders[index]['Result'] === 'N/A') {
overEmojiDiv.textContent = '';
}
overUnderDiv.appendChild(overEmojiDiv);
setTimeout(() => {
overUnderDiv.classList.remove('hidden');
}, 10);
const overUnderOverlayDiv = document.createElement('div');
overUnderOverlayDiv.className = 'overlay';
overUnderOverlayDiv.textContent = `${Math.round(data.over_unders[index]['Probability'][0] * 100)}%`;
overUnderDiv.appendChild(overUnderOverlayDiv);
overUnderCell.appendChild(overUnderDiv);
});
}
});
}
document.getElementById('submitButton').addEventListener('click', submitData);
document.addEventListener('keydown', function(event) {
if (event.keyCode === 13) {
submitData();
}
});
</script>
</body>
</html>
|