Spaces:
Sleeping
Sleeping
File size: 100,801 Bytes
efb7599 1748388 c14b6ea efb7599 9350f08 1748388 c22c3e3 efb7599 ef637fb 1748388 dd41a2d efb7599 9350f08 efb7599 9350f08 efb7599 95e1515 4606df8 95e1515 efb7599 23ffae0 5a55625 7b83067 efb7599 9fd8a8f ef637fb 9fd8a8f ef637fb 9fd8a8f efb7599 6619b0e 5227f18 6619b0e 5227f18 6619b0e 9350f08 6619b0e 9350f08 6619b0e 9350f08 6619b0e efb7599 1748388 efb7599 9350f08 1748388 6619b0e 1748388 6619b0e 1748388 6619b0e efb7599 1748388 9350f08 6619b0e 9350f08 cf113fe 6619b0e 9350f08 6619b0e 9350f08 6619b0e 9350f08 7bfcbcf a1616f7 1135bbc a1616f7 6619b0e 5227f18 efb7599 1748388 9350f08 6619b0e 9350f08 6619b0e efb7599 9350f08 6619b0e 1748388 31bf16f 23c6e83 5227f18 9350f08 5227f18 9350f08 5227f18 9350f08 5227f18 1748388 23c6e83 5227f18 6619b0e 5227f18 23c6e83 9350f08 23c6e83 5227f18 23c6e83 5227f18 23c6e83 5227f18 9350f08 9fd8a8f 4606df8 9fd8a8f 4606df8 9fd8a8f 9350f08 6619b0e 9350f08 6619b0e 9350f08 6619b0e 1748388 6619b0e 9350f08 6619b0e 9350f08 5227f18 9350f08 1748388 5227f18 1748388 9350f08 6619b0e 5227f18 98f83b6 9350f08 6619b0e 9350f08 6619b0e 9350f08 6619b0e 1748388 98f83b6 5227f18 98f83b6 9350f08 6619b0e 1748388 efb7599 1748388 9350f08 6619b0e 9350f08 6619b0e 1748388 a554ebd 9350f08 6619b0e 9350f08 6619b0e 1748388 9350f08 6619b0e 1748388 6619b0e 1748388 6619b0e 9350f08 6619b0e efb7599 1748388 f5d26be 9350f08 6619b0e 1748388 9350f08 6619b0e 1748388 ef637fb 9350f08 6619b0e 98f83b6 9350f08 6619b0e 1748388 9350f08 6619b0e 9350f08 6619b0e 5227f18 6619b0e 9350f08 5227f18 6619b0e 9350f08 6619b0e cc68695 6619b0e 9350f08 6619b0e 9350f08 6619b0e 9350f08 6619b0e 9350f08 6619b0e 9350f08 6619b0e 1748388 9350f08 6619b0e 9350f08 6619b0e 1748388 9350f08 6619b0e 1748388 6619b0e 1748388 9350f08 1748388 cc68695 23c6e83 f5d26be cba5895 f5d26be cba5895 f5d26be cba5895 f5d26be cba5895 f5d26be cba5895 f5d26be cba5895 f5d26be cc68695 f5d26be cc68695 f5d26be cba5895 f5d26be cba5895 f5d26be cc68695 f5d26be cc68695 6579da9 f5d26be cba5895 f5d26be cba5895 f5d26be cc68695 f5d26be cba5895 f5d26be cba5895 f5d26be cba5895 f5d26be cba5895 cc68695 f5d26be 23695ab ef637fb cba5895 23695ab 2b1472c 5227f18 95693a7 5227f18 2a2466c 2b1472c 2a2466c 9350f08 1c4c93a 6619b0e 14c3d2f 9350f08 14c3d2f 6201454 14c3d2f 6619b0e 1c4c93a 9350f08 6619b0e 14c3d2f 9b9ffd9 14c3d2f 9b9ffd9 14c3d2f 9b9ffd9 14c3d2f 6619b0e 9350f08 14c3d2f 5227f18 14c3d2f 5227f18 6619b0e 5227f18 6619b0e 9350f08 6619b0e 9350f08 5227f18 9350f08 6619b0e 14c3d2f 6619b0e 9350f08 6619b0e 1748388 9350f08 6619b0e 9350f08 6619b0e 9350f08 6619b0e efb7599 1748388 6619b0e 9350f08 1c4c93a 6619b0e 1748388 6619b0e 9350f08 6619b0e 9350f08 1748388 9350f08 6619b0e 1748388 21e9252 6619b0e 21e9252 14c3d2f 6201454 23c6e83 5227f18 23c6e83 5227f18 6619b0e 21e9252 6619b0e 21e9252 f5d26be 2a2466c 6619b0e 21e9252 6619b0e 21e9252 53c21f2 beebb43 6579da9 beebb43 4606df8 7bfcbcf 1135bbc 7bfcbcf 1135bbc 7bfcbcf 1135bbc 7bfcbcf 1135bbc 7bfcbcf a4815b4 7bfcbcf a4815b4 a1616f7 a4815b4 1135bbc a4815b4 2a2466c 23c6e83 53c21f2 23c6e83 53c21f2 23c6e83 a16e1fa beebb43 23c6e83 7bfcbcf a1616f7 7bfcbcf 2a2466c 53c21f2 6579da9 23c6e83 2a2466c a4815b4 2a2466c 1135bbc 53c21f2 1135bbc 4606df8 efb7599 33b1c3d efb7599 33b1c3d efb7599 33b1c3d efb7599 6201454 1748388 9350f08 1748388 7387e56 1748388 23ffae0 5a55625 23ffae0 7b83067 33b1c3d 14c3d2f 33b1c3d 14c3d2f 33b1c3d 14c3d2f 23ffae0 5a55625 14c3d2f 44fd024 14c3d2f 44fd024 d7f0845 6201454 14c3d2f 1748388 6201454 7387e56 6201454 1748388 9fd8a8f 1748388 695c823 ef637fb 9fd8a8f 695c823 ef637fb 9fd8a8f 1748388 9fd8a8f 7b705fb 9fd8a8f 7b705fb 9fd8a8f 1748388 ef637fb 1748388 ef637fb 1748388 ef637fb 1748388 695c823 1748388 9350f08 23695ab 4cefeb5 23695ab 88064ef 23695ab 23c6e83 14c3d2f 9fd8a8f 14c3d2f 9350f08 1748388 23695ab 1748388 309fd3d 1748388 9350f08 1748388 9350f08 5227f18 9350f08 5227f18 9350f08 5227f18 9350f08 1748388 695c823 1748388 695c823 1748388 9fd8a8f 6619b0e 9fd8a8f 6619b0e 9350f08 6619b0e 8436a06 6619b0e 8436a06 6619b0e 9350f08 21e9252 9350f08 6579da9 cc68695 ef637fb 8436a06 72b41d3 8436a06 445d547 8436a06 287c0c2 445d547 dd41a2d 05b18ba 74b7d29 dd41a2d 8436a06 05b18ba 74b7d29 05b18ba 8436a06 23695ab f5d26be cc68695 8436a06 ef637fb 23695ab d473813 287c0c2 23695ab cc68695 ef637fb cc68695 ef637fb cc68695 f5d26be 6579da9 cc68695 f5d26be 23c6e83 f5d26be 6579da9 f5d26be cc68695 6619b0e 9350f08 8436a06 23695ab 9350f08 695c823 23695ab ef637fb 5227f18 f5d26be 1748388 5227f18 f5d26be ef637fb f5d26be 23c6e83 f5d26be 1748388 f5d26be 1748388 9350f08 9fd8a8f 6619b0e 9fd8a8f 6619b0e 9350f08 6619b0e 9350f08 695c823 ef637fb 9350f08 23695ab 2b1472c 23695ab 5227f18 23695ab dd41a2d 23695ab 98f83b6 9350f08 5227f18 ef637fb 1748388 5227f18 98f83b6 9350f08 ef637fb 9350f08 c19efd2 1748388 a554ebd c19efd2 a554ebd 5227f18 c22c3e3 23695ab 9350f08 6619b0e 1748388 23695ab 23c6e83 23695ab 9350f08 23695ab 9350f08 23695ab 9350f08 23695ab 1748388 23c6e83 2b1472c a1616f7 23c6e83 23695ab c22c3e3 23695ab cf113fe c19efd2 5227f18 1748388 9350f08 8808f60 9350f08 21e9252 9350f08 21e9252 9350f08 5227f18 695c823 9350f08 89f4f3f 9350f08 5227f18 9350f08 23695ab 86148f3 8808f60 2b1472c a1616f7 8808f60 86148f3 7bfcbcf c19efd2 7bfcbcf c19efd2 5227f18 2a2466c 2b1472c 95693a7 2b1472c 2a2466c 2b1472c 95693a7 2b1472c 2a2466c 2b1472c 2a2466c 2b1472c 2a2466c 23695ab 9fd8a8f 23695ab 9d38fdf dd41a2d 2b1472c 23695ab 5227f18 23695ab 2b1472c 95693a7 2b1472c 2a2466c 95693a7 2b1472c 95693a7 2b1472c 95693a7 2b1472c 2a2466c 95693a7 2b1472c 2a2466c 23695ab 23c6e83 23695ab 2a2466c 23695ab 2b1472c 23695ab 2a2466c 23695ab 23c6e83 14c3d2f 23695ab 551e234 23695ab 5a55625 7b83067 23695ab 9350f08 1748388 23ffae0 efb7599 23ffae0 efb7599 23ffae0 ef637fb 3b06380 23ffae0 3b06380 23ffae0 3b06380 ef637fb 23ffae0 ef637fb 5a55625 23ffae0 ef637fb 23ffae0 5a55625 3b06380 23ffae0 efb7599 23ffae0 ef637fb 23ffae0 ef637fb 23ffae0 3b06380 23ffae0 14c3d2f efb7599 3b06380 efb7599 23ffae0 efb7599 14c3d2f 5a55625 14c3d2f efb7599 c14b6ea 9fd8a8f 9350f08 6579da9 9350f08 6579da9 9350f08 23ffae0 efb7599 23ffae0 efb7599 9350f08 23ffae0 efb7599 14c3d2f efb7599 23ffae0 aa81dcb efb7599 23ffae0 efb7599 9350f08 efb7599 9fd8a8f aa81dcb 14c3d2f 7bfcbcf 14c3d2f aa81dcb 14c3d2f efb7599 aa81dcb 23695ab 9350f08 efb7599 c22c3e3 a16e1fa 7bfcbcf 551e234 7bfcbcf 551e234 23ffae0 5a55625 551e234 23ffae0 551e234 23ffae0 551e234 23ffae0 551e234 c14b6ea 551e234 c14b6ea 14c3d2f 551e234 23ffae0 23695ab 7bfcbcf 23ffae0 efb7599 23ffae0 aa81dcb 1748388 efb7599 9fd8a8f a16e1fa 9fd8a8f | 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 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 | from __future__ import annotations
import html
import inspect
import json
import math
import re
from datetime import datetime
from functools import lru_cache
from pathlib import Path
from typing import Any
import gradio as gr
from packing_benchmark.dates import (
date_from_friedman_record,
date_from_submission,
display_date_info,
is_recent_date_info,
parse_friedman_date_text,
)
from packing_benchmark.hub_sync import maybe_hydrate_from_dataset
from packing_benchmark.store import SolutionStore, is_trivial_record
from packing_benchmark.verifier import (
DEFAULT_TOLERANCE,
load_solution_json,
make_container_shape,
make_item_shape,
normalize_solution,
solution_case,
solution_hash,
verify_solution,
)
SPACE_ROOT = Path(__file__).resolve().parent
DATA_DIR = SPACE_ROOT / "data"
DATA_DIR.mkdir(parents=True, exist_ok=True)
FAVICON_PATH = SPACE_ROOT / "assets" / "favicon.svg"
HYDRATE_STATUS = maybe_hydrate_from_dataset(DATA_DIR)
STORE = SolutionStore(DATA_DIR)
SUBMISSION_MIN_IMPROVEMENT = 1.0e-4
SUBMISSION_MAX_NEW_CASE_N = 100
VERIFIER_REPO_URL = "https://github.com/Nathan-Roll1/packing-verifier"
@lru_cache(maxsize=1)
def cached_reference_records() -> list[dict[str, Any]]:
return STORE.load_reference_records()
@lru_cache(maxsize=1)
def cached_verified_records() -> list[dict[str, Any]]:
return STORE.load_records()
@lru_cache(maxsize=1)
def cached_family_updates() -> dict[str, Any]:
path = DATA_DIR / "friedman_family_updates.json"
if not path.exists():
return {}
try:
payload = json.loads(path.read_text())
except Exception:
return {}
families = payload.get("families", {})
return families if isinstance(families, dict) else {}
@lru_cache(maxsize=64)
def cached_public_records(setup: str = "", show_all: bool = False) -> list[dict[str, Any]]:
return STORE.public_records(setup or None, show_all=show_all)
def clear_page_caches() -> None:
cached_reference_records.cache_clear()
cached_verified_records.cache_clear()
cached_family_updates.cache_clear()
cached_public_records.cache_clear()
setup_choices.cache_clear()
coordinate_records_by_case.cache_clear()
family_page_html.cache_clear()
directory_html.cache_clear()
CSS = """
:root {
color-scheme: light;
--page: #f3eddf;
--paper: #fffdf7;
--paper-soft: #faf6ec;
--ink: #151515;
--muted: #58544d;
--quiet: #7b766d;
--line: #1b1b1b;
--line-soft: #d4cab8;
--green: #b9e7bd;
--green-strong: #2e7d32;
--link: #174f8a;
--tri: #e69f00;
--cir: #56b4e9;
--squ: #009e73;
--pen: #f0e442;
--hex: #0072b2;
--oct: #d55e00;
--dom: #cc79a7;
--unknown-shape: #999999;
--radius: 6px;
}
html,
body,
gradio-app,
.gradio-container,
.main,
.app {
background: var(--page) !important;
color: var(--ink) !important;
font-family: Helvetica, Arial, sans-serif !important;
}
.gradio-container {
max-width: none !important;
margin: 0 !important;
padding: 0 !important;
font-family: Helvetica, Arial, sans-serif !important;
line-height: 1.45;
}
.gradio-container *,
.gradio-container button,
.gradio-container input,
.gradio-container textarea,
.gradio-container select {
box-sizing: border-box;
font-family: Helvetica, Arial, sans-serif !important;
letter-spacing: 0 !important;
}
.gradio-container a {
color: var(--link) !important;
text-decoration: underline;
text-underline-offset: 2px;
}
.contain {
width: min(1180px, calc(100% - 32px));
margin: 0 auto;
}
.packing-shell {
min-height: 0;
background: var(--page);
color: var(--ink);
font-family: Helvetica, Arial, sans-serif !important;
padding-bottom: 44px;
}
.packing-shell * {
font-family: Helvetica, Arial, sans-serif !important;
}
#leaderboard-panel,
#submit-entry-panel {
display: none;
}
#leaderboard-panel:target,
#submit-entry-panel:target,
#leaderboard-panel:target #leaderboard-panel,
#submit-entry-panel:target #submit-entry-panel,
html:has(#leaderboard-table:target) #leaderboard-panel,
html:has(.leaderboard-modal:target) #leaderboard-panel {
display: block !important;
}
html:has(#leaderboard-panel:target) #home-panel,
html:has(#submit-entry-panel:target) #home-panel,
html:has(#leaderboard-table:target) #home-panel,
html:has(.leaderboard-modal:target) #home-panel {
display: none !important;
}
html:has(#leaderboard-panel:target) #submit-entry-panel,
html:has(#leaderboard-table:target) #submit-entry-panel,
html:has(.leaderboard-modal:target) #submit-entry-panel,
html:has(#submit-entry-panel:target) #leaderboard-panel {
display: none !important;
}
.hero-stage {
border-bottom: 2px solid var(--line);
padding: 30px 0 20px;
}
.hero-stage h1 {
margin: 0 0 10px;
color: var(--ink);
font-size: 36px;
line-height: 1.05;
font-weight: 700;
}
.hero-copy {
max-width: 820px;
margin: 0;
color: var(--muted);
font-size: 16px;
line-height: 1.55;
}
.gradio-container .tab-nav,
.gradio-container [role="tablist"] {
display: none !important;
}
.site-nav {
position: sticky !important;
top: 0;
z-index: 50;
min-height: 48px;
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 8px;
padding: 7px max(16px, calc((100% - 1180px) / 2)) !important;
background: rgba(243, 237, 223, 0.98) !important;
border-bottom: 1px solid var(--line) !important;
}
.site-nav-link {
display: inline-flex;
align-items: center;
justify-content: center;
min-height: 32px !important;
padding: 5px 11px !important;
background: transparent !important;
border: 1px solid transparent !important;
border-radius: 4px !important;
box-shadow: none !important;
color: var(--ink) !important;
font-size: 14px !important;
font-weight: 700 !important;
line-height: 1.2;
text-decoration: none !important;
}
.site-nav-link:hover,
.site-nav-link.active {
background: var(--paper) !important;
border-color: var(--line) !important;
}
.site-nav-link.submit-link {
margin-left: auto !important;
background: var(--green-strong) !important;
border-color: #1f5d25 !important;
color: #fff !important;
}
.site-nav-link.submit-link:hover,
.site-nav-link.submit-link.active {
background: #236c29 !important;
color: #fff !important;
}
footer,
.gradio-container footer,
.gradio-container .footer,
.gradio-container .built-with,
.gradio-container .api-docs,
.gradio-container .app > header,
.gradio-container .app > .header,
.gradio-container .contain > button:not(.site-nav-link),
.gradio-container a[href*="view=api"],
.gradio-container a[href*="/api"],
.gradio-container button[aria-label="Settings"],
.gradio-container button[title="Settings"],
.gradio-container button[aria-label="More"],
.gradio-container button[aria-label="More options"],
.gradio-container button[title="More"],
.gradio-container button[title="More options"],
.gradio-container [data-testid="settings-button"],
.gradio-container [data-testid="more-button"],
.gradio-container [data-testid="app-menu"],
.gradio-container [data-testid="menu-button"],
.gradio-container [class*="settings"],
.gradio-container [class*="kebab"],
.gradio-container [class*="ellipsis"] {
display: none !important;
}
.section {
padding: 30px 0 8px;
}
.section-head {
display: flex;
justify-content: space-between;
gap: 20px;
align-items: end;
margin-bottom: 16px;
}
.section-head h2,
.family-title-card h2 {
margin: 0 0 4px;
color: var(--ink);
font-size: 24px;
line-height: 1.2;
font-weight: 700;
}
.section-note,
.family-subtitle {
margin: 0;
color: var(--muted);
font-size: 14px;
line-height: 1.45;
}
.family-matrix {
display: grid;
gap: 22px;
}
.family-row {
padding-top: 14px;
border-top: 1px solid var(--line);
}
.family-row:first-child {
padding-top: 0;
border-top: 0;
}
.family-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(178px, 1fr));
gap: 10px;
}
.family-card {
display: block;
min-height: 218px;
padding: 12px;
color: var(--ink) !important;
text-decoration: none !important;
background: var(--paper);
border: 1px solid var(--line);
border-radius: var(--radius);
}
.family-card:hover,
.family-card:focus-visible {
background: #fffaf0;
outline: 2px solid var(--line);
outline-offset: 2px;
}
.family-card-top {
display: block;
}
.family-render {
height: 150px;
margin: 8px 0 10px;
}
.family-render .packing-svg {
max-width: 160px;
max-height: 160px;
}
.family-code {
margin: 0 0 7px;
color: var(--quiet);
font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace !important;
font-size: 12px;
text-transform: uppercase;
}
.family-card h3 {
margin: 0;
color: var(--ink);
font-size: 18px;
line-height: 1.22;
font-weight: 700;
}
.front-family-card {
min-height: 232px;
margin-bottom: 8px;
}
.front-family-card .family-render {
height: 154px;
}
.record-book {
padding: 10px 0 0;
}
.family-section {
margin-top: 34px;
padding-top: 22px;
border-top: 2px solid var(--line);
}
.family-title-card {
display: flex;
align-items: end;
justify-content: space-between;
gap: 18px;
margin-bottom: 14px;
}
.record-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(178px, 1fr));
gap: 12px;
}
.record-card {
overflow: hidden;
background: var(--paper);
border: 1px solid var(--line);
border-radius: var(--radius);
color: var(--ink);
}
.record-card:hover,
.record-card:focus-within {
background: #fffaf0;
outline: 2px solid var(--line);
outline-offset: 2px;
}
.record-open {
display: block;
color: inherit !important;
text-decoration: none !important;
}
.record-top {
padding: 9px 10px 0;
}
.record-case {
color: var(--ink);
font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace !important;
font-size: 12px;
font-weight: 700;
}
.recent-dot {
display: inline-block;
width: 9px;
height: 9px;
margin-left: 7px;
background: var(--green-strong);
border: 1px solid #174c1b;
border-radius: 999px;
vertical-align: 1px;
}
.family-card h3 .recent-dot {
width: 10px;
height: 10px;
vertical-align: 2px;
}
.render-stage {
height: 178px;
margin: 8px 10px 0;
display: grid;
place-items: center;
background: transparent;
border: 0;
border-radius: 0;
}
.placeholder,
.empty-state {
padding: 0 14px;
color: var(--quiet);
font-size: 12px;
line-height: 1.35;
text-align: center;
}
.packing-svg {
display: block;
width: 100%;
height: 100%;
max-width: 162px;
max-height: 162px;
overflow: visible;
}
.shape-item {
fill: var(--unknown-shape);
stroke: #000;
stroke-width: 1.5px !important;
stroke-linejoin: round;
vector-effect: non-scaling-stroke;
}
.shape-item.inner-tri { fill: var(--tri); }
.shape-item.inner-cir { fill: var(--cir); }
.shape-item.inner-squ { fill: var(--squ); }
.shape-item.inner-pen { fill: var(--pen); }
.shape-item.inner-hex { fill: var(--hex); }
.shape-item.inner-oct { fill: var(--oct); }
.shape-item.inner-dom { fill: var(--dom); }
.shape-container {
fill: none;
stroke: #000;
stroke-width: 2.6px !important;
stroke-linejoin: round;
vector-effect: non-scaling-stroke;
}
.record-body {
padding: 9px 10px 12px;
}
.metric {
display: flex;
align-items: baseline;
justify-content: space-between;
gap: 8px;
color: var(--ink);
}
.metric strong {
color: var(--ink);
font-size: 17px;
line-height: 1.2;
}
.metric span {
color: var(--muted);
font-size: 12px;
white-space: nowrap;
}
.expression {
min-height: 18px;
margin-top: 4px;
color: var(--muted);
font-size: 12px;
line-height: 1.35;
overflow-wrap: anywhere;
}
.meta {
margin-top: 8px;
padding-top: 8px;
border-top: 1px solid var(--line-soft);
color: var(--muted);
font-size: 12px;
line-height: 1.4;
}
.meta strong {
color: var(--ink);
}
.record-author {
margin-top: 8px;
color: var(--muted);
font-size: 12px;
line-height: 1.35;
}
.record-author strong {
color: var(--ink);
}
.trivial-badge {
display: inline-flex;
align-items: center;
min-height: 22px;
padding: 2px 7px;
background: var(--paper-soft);
border: 1px solid var(--line);
border-radius: 4px;
color: var(--ink);
font-size: 11px;
font-weight: 700;
line-height: 1.1;
text-transform: uppercase;
}
.page-card {
background: var(--paper);
border: 1px solid var(--line);
border-radius: var(--radius);
padding: 16px;
}
.record-modal {
display: none;
position: fixed;
inset: 0;
z-index: 1000;
align-items: center;
justify-content: center;
padding: 24px;
}
.record-modal:target {
display: flex;
}
.modal-backdrop {
position: absolute;
inset: 0;
background: rgba(21, 21, 21, 0.42);
}
.modal-panel {
position: relative;
z-index: 1;
width: min(920px, calc(100vw - 32px));
max-height: calc(100vh - 32px);
overflow: auto;
background: var(--paper) !important;
border: 2px solid var(--line);
border-radius: var(--radius);
color: var(--ink) !important;
box-shadow: 0 16px 40px rgba(0, 0, 0, 0.24);
}
.record-modal,
.record-modal .modal-panel,
.record-modal .modal-panel * {
color: var(--ink) !important;
}
.modal-close {
position: absolute;
top: 12px;
right: 12px;
display: grid;
place-items: center;
width: 32px;
height: 32px;
background: var(--paper) !important;
border: 1px solid var(--line);
border-radius: 4px;
color: var(--ink) !important;
font-size: 18px;
font-weight: 700;
line-height: 1;
text-decoration: none !important;
}
.modal-close:hover,
.modal-close:focus-visible {
background: #fffaf0 !important;
outline: 2px solid var(--line);
outline-offset: 2px;
}
.modal-head {
padding: 18px 58px 12px 18px;
border-bottom: 1px solid var(--line);
}
.modal-case {
margin: 0 0 4px;
color: var(--quiet) !important;
font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace !important;
font-size: 12px;
font-weight: 700;
text-transform: uppercase;
}
.modal-head h3 {
margin: 0;
color: var(--ink) !important;
font-size: 22px;
line-height: 1.2;
}
.modal-subtitle {
margin-top: 7px;
color: var(--muted) !important;
font-size: 13px;
line-height: 1.45;
}
.modal-layout {
display: grid;
grid-template-columns: minmax(240px, 340px) 1fr;
gap: 18px;
padding: 18px;
}
.modal-visual .render-stage {
height: 320px;
margin: 0;
}
.modal-visual .packing-svg {
max-width: 300px;
max-height: 300px;
}
.download-actions {
display: flex;
justify-content: center;
gap: 8px;
margin-top: 10px;
}
.download-btn {
appearance: none;
min-height: 32px;
padding: 6px 10px;
background: var(--paper-soft) !important;
border: 1px solid var(--line);
border-radius: 4px;
color: var(--ink) !important;
cursor: pointer;
font-size: 12px;
font-weight: 700;
line-height: 1;
}
.download-btn:hover,
.download-btn:focus-visible {
background: #fffaf0 !important;
outline: 2px solid var(--line);
outline-offset: 2px;
}
.modal-metric {
margin-bottom: 14px;
padding: 10px 12px;
background: var(--paper-soft) !important;
border: 1px solid var(--line-soft);
border-radius: var(--radius);
}
.modal-metric strong {
display: block;
color: var(--ink) !important;
font-size: 20px;
line-height: 1.2;
}
.modal-metric span {
display: block;
margin-top: 3px;
color: var(--muted) !important;
font-size: 13px;
}
.modal-details {
margin: 0;
display: grid;
grid-template-columns: 142px minmax(0, 1fr);
gap: 8px 14px;
color: var(--muted) !important;
font-size: 13px;
line-height: 1.42;
}
.modal-details dt {
color: var(--ink) !important;
font-weight: 700;
}
.modal-details dd {
margin: 0;
color: var(--muted) !important;
overflow-wrap: anywhere;
}
.modal-details a {
color: var(--link) !important;
}
.previous-bests-table {
width: 100%;
border-collapse: collapse;
background: var(--paper) !important;
color: var(--ink) !important;
font-size: 12px;
}
.previous-bests-table th,
.previous-bests-table td {
padding: 6px 7px;
border: 1px solid var(--line-soft);
color: var(--ink) !important;
text-align: left;
vertical-align: top;
}
.previous-bests-table th {
background: var(--paper-soft) !important;
font-weight: 700;
}
.date-source {
color: var(--muted) !important;
}
.record-modal .modal-panel .modal-case {
color: var(--quiet) !important;
}
.record-modal .modal-panel .modal-subtitle,
.record-modal .modal-panel .modal-metric span,
.record-modal .modal-panel .modal-details,
.record-modal .modal-panel .modal-details dd {
color: var(--muted) !important;
}
.record-modal .modal-panel .modal-head h3,
.record-modal .modal-panel .modal-metric strong,
.record-modal .modal-panel .modal-details dt,
.record-modal .modal-panel .modal-subtitle strong,
.record-modal .modal-panel .modal-close {
color: var(--ink) !important;
}
.record-modal .modal-panel .modal-details a {
color: var(--link) !important;
}
.leaderboard-table {
width: 100%;
border-collapse: collapse;
background: var(--paper);
border: 1px solid var(--line);
}
.leaderboard-table th,
.leaderboard-table td {
padding: 10px 12px;
border-bottom: 1px solid var(--line-soft);
color: var(--ink);
text-align: left;
vertical-align: top;
}
.leaderboard-table th {
background: var(--paper-soft);
font-size: 12px;
text-transform: uppercase;
}
.leaderboard-table th:not(:nth-child(2)),
.leaderboard-table td:not(:nth-child(2)) {
text-align: center;
}
.leaderboard-table th:nth-child(2),
.leaderboard-table td:nth-child(2) {
text-align: left;
}
.leaderboard-table strong,
.leaderboard-table a {
color: var(--ink) !important;
}
.leaderboard-best {
font-weight: 800;
}
.leaderboard-best strong {
font-weight: 800;
}
.case-links {
max-width: 560px;
color: var(--ink);
font-size: 13px;
line-height: 1.55;
}
.case-links a {
display: inline-block;
margin-right: 6px;
color: var(--link) !important;
}
.leaderboard-author-link,
.leaderboard-author-link strong {
color: var(--ink) !important;
font-weight: 700;
}
.leaderboard-author-link {
text-decoration: underline;
text-underline-offset: 2px;
}
.leaderboard-table .leaderboard-open {
white-space: nowrap;
}
.leaderboard-stat-grid {
display: grid;
grid-template-columns: repeat(4, minmax(0, 1fr));
gap: 10px;
margin: 0 0 16px;
}
.leaderboard-stat {
padding: 10px 12px;
background: var(--paper-soft);
border: 1px solid var(--line-soft);
border-radius: var(--radius);
}
.leaderboard-stat strong {
display: block;
color: var(--ink) !important;
font-size: 22px;
line-height: 1.15;
}
.leaderboard-stat span {
display: block;
margin-top: 3px;
color: var(--muted) !important;
font-size: 12px;
}
.leaderboard-class-strip {
display: flex;
flex-wrap: wrap;
gap: 7px;
margin: 0 0 14px;
}
.leaderboard-class-strip span {
display: inline-flex;
align-items: center;
gap: 5px;
padding: 4px 7px;
background: #fff !important;
border: 1px solid var(--line-soft);
border-radius: 4px;
color: var(--muted) !important;
font-size: 12px;
}
.leaderboard-class-strip strong {
color: var(--ink) !important;
}
.leaderboard-full-list {
display: flex;
flex-wrap: wrap;
gap: 6px;
max-height: 260px;
overflow: auto;
padding: 1px;
}
.leaderboard-full-list a {
display: inline-block;
padding: 4px 7px;
color: var(--ink) !important;
background: #fff !important;
border: 1px solid var(--line-soft);
border-radius: 4px;
font-size: 12px;
line-height: 1.2;
text-decoration: none;
}
.leaderboard-modal .modal-layout {
grid-template-columns: 1fr;
}
.leaderboard-modal .case-links {
max-width: none;
margin-bottom: 14px;
}
.submit-shell,
.schema-shell,
.family-button-shell {
width: min(1180px, calc(100% - 32px));
margin: 18px auto 44px;
color: var(--ink) !important;
}
.submit-hero {
padding-bottom: 0;
}
.submit-hero .section-head {
align-items: start;
}
.submit-flow {
display: grid;
grid-template-columns: repeat(3, minmax(0, 1fr));
gap: 10px;
margin-top: 16px;
}
.submission-guide {
margin-top: 18px;
}
.guide-grid {
display: grid;
grid-template-columns: repeat(2, minmax(0, 1fr));
gap: 12px;
}
.guide-card {
min-width: 0;
padding: 14px;
background: var(--paper);
border: 1px solid var(--line);
border-radius: var(--radius);
}
.guide-card.wide {
grid-column: 1 / -1;
}
.guide-card h3 {
margin: 0 0 8px;
color: var(--ink);
font-size: 16px;
line-height: 1.25;
}
.guide-card p,
.guide-card li {
color: var(--muted) !important;
font-size: 13px;
line-height: 1.45;
}
.guide-card ul {
margin: 8px 0 0;
padding-left: 18px;
}
.code-block {
max-height: 360px;
overflow: auto;
margin: 10px 0 0;
padding: 12px;
background: #fff !important;
color: var(--ink) !important;
border: 1px solid var(--line-soft);
border-radius: var(--radius);
font-size: 12px;
line-height: 1.45;
white-space: pre;
}
.code-block code {
color: var(--ink) !important;
font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace !important;
}
.submit-step {
min-height: 96px;
padding: 12px;
background: var(--paper-soft);
border: 1px solid var(--line);
border-radius: var(--radius);
}
.submit-step strong {
display: block;
margin-bottom: 4px;
color: var(--ink);
font-size: 14px;
}
.submit-step span {
color: var(--muted) !important;
font-size: 13px;
line-height: 1.4;
}
.submit-shell > .gradio-group,
.schema-shell > .gradio-group,
.family-button-shell > .gradio-group,
.gradio-container .accordion,
.gradio-container .block,
.gradio-container .form,
.gradio-container .panel,
.gradio-container .input-container,
.gradio-container .wrap {
background: var(--paper) !important;
color: var(--ink) !important;
border-color: var(--line-soft) !important;
box-shadow: none !important;
}
.submit-shell > .gradio-group {
padding: 0 !important;
background: transparent !important;
border: 0 !important;
}
.submit-layout {
align-items: stretch !important;
gap: 14px !important;
}
.submit-editor,
.submit-meta,
.submit-results {
min-width: 0;
}
.submit-panel,
.submit-doc-panel,
.submit-results-card {
height: 100%;
padding: 14px !important;
background: var(--paper) !important;
border: 1px solid var(--line) !important;
border-radius: var(--radius) !important;
box-shadow: none !important;
}
.submit-panel-title {
margin: 0 0 10px;
color: var(--ink);
font-size: 16px;
line-height: 1.25;
font-weight: 700;
}
.submit-panel-note {
margin: -4px 0 12px;
color: var(--muted) !important;
font-size: 13px;
line-height: 1.45;
}
.submit-actions {
gap: 8px !important;
}
.submit-actions button {
min-height: 38px !important;
font-weight: 700 !important;
}
.verification-report {
min-height: 152px;
margin-top: 8px;
padding: 12px;
background: var(--paper-soft) !important;
color: var(--ink) !important;
border: 1px solid var(--line-soft) !important;
border-radius: var(--radius);
}
.verification-report,
.verification-report *,
.submit-results-card .verification-report,
.submit-results-card .verification-report * {
color: var(--ink) !important;
}
.verification-report .markdown,
.verification-report .prose,
.verification-report [data-testid="markdown"],
.verification-report [class*="markdown"],
.verification-report [class*="prose"] {
background: transparent !important;
color: var(--ink) !important;
}
.verification-report h1,
.verification-report h2,
.verification-report h3,
.verification-report h4 {
margin-top: 0 !important;
color: var(--ink) !important;
}
.verification-report p,
.verification-report li,
.verification-report ul,
.verification-report ol {
color: var(--ink) !important;
}
.verification-report code {
display: inline-block;
padding: 1px 5px;
background: #fff !important;
color: var(--ink) !important;
border: 1px solid var(--line-soft);
border-radius: 4px;
font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace !important;
}
.verification-report pre,
.verification-report pre code {
display: block;
background: #fff !important;
color: var(--ink) !important;
border-color: var(--line-soft) !important;
}
.submit-docs {
margin-top: 14px;
}
.submit-docs .accordion,
.submit-docs details {
border: 1px solid var(--line) !important;
border-radius: var(--radius) !important;
background: var(--paper) !important;
}
.submit-docs code,
.submit-docs pre {
background: #fff !important;
border-color: var(--line-soft) !important;
}
.gradio-container label,
.gradio-container .label-wrap,
.gradio-container .markdown,
.gradio-container .prose,
.gradio-container p,
.gradio-container span,
.gradio-container h1,
.gradio-container h2,
.gradio-container h3,
.gradio-container h4,
.gradio-container code,
.gradio-container pre {
color: var(--ink) !important;
}
.gradio-container textarea,
.gradio-container input,
.gradio-container select,
.gradio-container [role="combobox"],
.gradio-container .input-container textarea,
.gradio-container .input-container input {
background: #fff !important;
color: var(--ink) !important;
border-color: var(--line-soft) !important;
}
.gradio-container [role="listbox"],
.gradio-container [role="option"],
.gradio-container .dropdown,
.gradio-container .options,
.gradio-container .item {
background: #fff !important;
color: var(--ink) !important;
}
.gradio-container .code_wrap,
.gradio-container .cm-editor,
.gradio-container .cm-scroller,
.gradio-container .cm-content,
.gradio-container .cm-gutters,
.gradio-container .cm-line,
.gradio-container .cm-activeLine,
.gradio-container .cm-activeLineGutter {
background: #fff !important;
color: var(--ink) !important;
border-color: var(--line-soft) !important;
}
.gradio-container .cm-cursor {
border-left-color: var(--ink) !important;
}
.gradio-container button {
border-radius: 4px !important;
border: 1px solid var(--line) !important;
box-shadow: none !important;
color: var(--ink) !important;
background: #fff !important;
}
.gradio-container button.primary,
.gradio-container button[variant="primary"] {
color: #fff !important;
background: var(--green-strong) !important;
}
.preview-card {
max-width: 420px;
background: var(--paper);
border: 1px solid var(--line);
border-radius: var(--radius);
padding: 10px;
}
.preview-card .render-stage {
height: 340px;
margin: 0;
}
.preview-card .packing-svg {
max-width: 315px;
max-height: 315px;
}
@media (max-width: 720px) {
.contain,
.submit-shell,
.schema-shell,
.family-button-shell {
width: min(100% - 22px, 1180px);
}
.hero-stage {
padding-top: 26px;
}
.hero-stage h1 {
font-size: 30px;
}
.family-title-card,
.section-head {
display: block;
}
.submit-flow {
grid-template-columns: 1fr;
}
.guide-grid {
grid-template-columns: 1fr;
}
.site-nav {
padding: 7px 11px !important;
}
.site-nav-link.submit-link {
margin-left: 0 !important;
}
.record-grid {
grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
}
.record-modal {
padding: 12px;
}
.modal-head {
padding: 16px 54px 12px 14px;
}
.modal-layout {
display: block;
padding: 14px;
}
.modal-visual {
margin-bottom: 14px;
}
.modal-visual .render-stage {
height: 240px;
}
.modal-visual .packing-svg {
max-width: 220px;
max-height: 220px;
}
.modal-details {
grid-template-columns: 1fr;
gap: 3px;
}
.modal-details dd {
margin-bottom: 8px;
}
.leaderboard-stat-grid {
grid-template-columns: repeat(2, minmax(0, 1fr));
}
.render-stage {
height: 154px;
}
.packing-svg {
max-width: 140px;
max-height: 140px;
}
}
"""
APP_JS = """
() => {
const cleanHomeUrl = () => `${window.location.origin}${window.location.pathname}`;
const SVG_DOWNLOAD_STYLE = `
.shape-item {
fill: #999999;
stroke: #000000;
stroke-width: 1.5px;
stroke-linejoin: round;
vector-effect: non-scaling-stroke;
}
.shape-item.inner-tri { fill: #e69f00; }
.shape-item.inner-cir { fill: #56b4e9; }
.shape-item.inner-squ { fill: #009e73; }
.shape-item.inner-pen { fill: #f0e442; }
.shape-item.inner-hex { fill: #0072b2; }
.shape-item.inner-oct { fill: #d55e00; }
.shape-item.inner-dom { fill: #cc79a7; }
.shape-container {
fill: none;
stroke: #000000;
stroke-width: 2.6px;
stroke-linejoin: round;
vector-effect: non-scaling-stroke;
}
`;
const sanitizedFileName = (name, extension) => {
const base = (name || "packing-record")
.replace(/@/g, "-")
.replace(/[^a-zA-Z0-9._-]+/g, "-")
.replace(/^-+|-+$/g, "") || "packing-record";
return base.toLowerCase().endsWith(`.${extension}`) ? base : `${base}.${extension}`;
};
const serializePackingSvg = (svg) => {
const clone = svg.cloneNode(true);
clone.setAttribute("xmlns", "http://www.w3.org/2000/svg");
clone.setAttribute("width", "900");
clone.setAttribute("height", "900");
if (!clone.getAttribute("viewBox")) {
const box = svg.getBBox ? svg.getBBox() : null;
if (box) {
clone.setAttribute("viewBox", `${box.x} ${box.y} ${box.width} ${box.height}`);
}
}
const style = document.createElementNS("http://www.w3.org/2000/svg", "style");
style.textContent = SVG_DOWNLOAD_STYLE;
clone.insertBefore(style, clone.firstChild);
return `<?xml version="1.0" encoding="UTF-8"?>\n${new XMLSerializer().serializeToString(clone)}`;
};
const triggerFileDownload = (blob, filename) => {
const url = URL.createObjectURL(blob);
const link = document.createElement("a");
link.href = url;
link.download = filename;
document.body.appendChild(link);
link.click();
link.remove();
window.setTimeout(() => URL.revokeObjectURL(url), 1000);
};
const downloadSvg = (svg, filenameBase) => {
const source = serializePackingSvg(svg);
triggerFileDownload(new Blob([source], {type: "image/svg+xml;charset=utf-8"}), sanitizedFileName(filenameBase, "svg"));
};
const downloadPng = (svg, filenameBase) => {
const source = serializePackingSvg(svg);
const svgBlob = new Blob([source], {type: "image/svg+xml;charset=utf-8"});
const url = URL.createObjectURL(svgBlob);
const image = new Image();
image.onload = () => {
const size = 900;
const canvas = document.createElement("canvas");
canvas.width = size;
canvas.height = size;
const context = canvas.getContext("2d");
context.clearRect(0, 0, size, size);
context.drawImage(image, 0, 0, size, size);
URL.revokeObjectURL(url);
canvas.toBlob((blob) => {
if (blob) {
triggerFileDownload(blob, sanitizedFileName(filenameBase, "png"));
}
}, "image/png");
};
image.onerror = () => {
URL.revokeObjectURL(url);
window.alert("Could not prepare this rendering for download.");
};
image.src = url;
};
const handleImageDownload = (event) => {
const button = event.target && event.target.closest
? event.target.closest("[data-download-image]")
: null;
if (!button) {
return;
}
event.preventDefault();
event.stopPropagation();
if (event.stopImmediatePropagation) {
event.stopImmediatePropagation();
}
const scope = button.closest(".modal-panel, .preview-card, .record-card, .family-card, .packing-shell") || document;
const svg = scope.querySelector("svg.packing-svg");
if (!svg) {
window.alert("No coordinate rendering is available for this record yet.");
return;
}
const format = button.getAttribute("data-download-image");
const filenameBase = button.getAttribute("data-download-filename")
|| svg.getAttribute("aria-label")
|| "packing-record";
if (format === "png") {
downloadPng(svg, filenameBase);
} else {
downloadSvg(svg, filenameBase);
}
};
const normalizedLabels = (element) => {
if (!element) {
return [];
}
return [
element.getAttribute("aria-label"),
element.innerText,
element.textContent,
].map((value) => (value || "").replace(/\\s+/g, " ").trim().toLowerCase()).filter(Boolean);
};
const isInsideBenchmarkUi = (element) => Boolean(
element.closest(".packing-shell, .site-nav, .submit-shell, .schema-shell, .record-modal, .modal-panel")
);
const hideGradioChrome = () => {
Array.from(document.querySelectorAll("footer, button, a")).forEach((element) => {
if (isInsideBenchmarkUi(element)) {
return;
}
const labels = normalizedLabels(element).join(" ");
const text = (element.innerText || element.textContent || "").replace(/\\s+/g, "").trim();
const rect = element.getBoundingClientRect ? element.getBoundingClientRect() : null;
const iconOnlyTopRight = rect
&& rect.top >= 0
&& rect.top < 84
&& rect.right > window.innerWidth - 120
&& rect.width <= 84
&& rect.height <= 84
&& Boolean(element.querySelector && element.querySelector("svg"));
const chromeText = /settings|more|menu|useviaapi|builtwithgradio/.test(labels.replace(/\\s+/g, ""))
|| /^(\\.\\.\\.|…|⋯|⋮)$/.test(text);
if (chromeText || iconOnlyTopRight || element.tagName.toLowerCase() === "footer") {
element.style.setProperty("display", "none", "important");
element.setAttribute("aria-hidden", "true");
}
});
};
const panelIds = {
home: "home-panel",
leaderboard: "leaderboard-panel",
submit: "submit-entry-panel",
};
const panelElements = (id) => Array.from(document.querySelectorAll(`[id="${id}"]`));
const setPanelVisible = (id, visible) => {
const elements = panelElements(id);
if (!elements.length) {
return;
}
elements.forEach((element) => {
if (visible) {
element.style.setProperty("display", "block", "important");
} else {
element.style.setProperty("display", "none", "important");
}
});
};
const applyRoute = (route) => {
const selected = route === "leaderboard" || route === "submit" ? route : "home";
if (document.body) {
document.body.dataset.packingRoute = selected;
}
Object.entries(panelIds).forEach(([name, id]) => setPanelVisible(id, name === selected));
document.querySelectorAll("[data-route]").forEach((element) => {
element.classList.toggle("active", element.getAttribute("data-route") === selected);
});
hideGradioChrome();
};
const currentRoute = () => {
const hash = (window.location.hash || "").replace(/^#/, "");
if (hash === "home" || hash === "home-panel") {
return "home";
}
if (hash === "leaderboard" || hash === "leaderboard-panel") {
return "leaderboard";
}
if (hash === "submit" || hash === "submit-entry-panel") {
return "submit";
}
if (hash === "leaderboard-table" || hash.startsWith("leaderboard-author-")) {
return "leaderboard";
}
const view = new URLSearchParams(window.location.search).get("view");
if (view === "leaderboard" || view === "submit") {
return view;
}
return (document.body && document.body.dataset.packingRoute) || "home";
};
const syncRoute = () => applyRoute(currentRoute());
const routeFromClick = (event) => {
const control = event.target && event.target.closest
? event.target.closest("[data-route], .site-nav-link")
: null;
if (!control) {
return;
}
const route = control.getAttribute("data-route");
if (!route) {
return;
}
if (route === "home") {
event.preventDefault();
event.stopPropagation();
if (event.stopImmediatePropagation) {
event.stopImmediatePropagation();
}
window.location.assign(cleanHomeUrl());
return;
}
if (route === "leaderboard" || route === "submit") {
event.preventDefault();
event.stopPropagation();
if (event.stopImmediatePropagation) {
event.stopImmediatePropagation();
}
window.history.pushState(null, "", `${cleanHomeUrl()}#${panelIds[route]}`);
applyRoute(route);
window.setTimeout(syncRoute, 40);
}
};
document.addEventListener("click", handleImageDownload, true);
document.addEventListener("click", routeFromClick, true);
window.addEventListener("popstate", syncRoute);
window.addEventListener("hashchange", syncRoute);
document.addEventListener("DOMContentLoaded", syncRoute);
syncRoute();
[40, 140, 400, 900, 1800, 3200].forEach((delay) => window.setTimeout(syncRoute, delay));
new MutationObserver(syncRoute).observe(document.documentElement || document, {childList: true, subtree: true});
}
"""
APP_HEAD = f"""
<script>
({APP_JS})();
</script>
<link rel="icon" type="image/svg+xml" href="data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2064%2064%22%3E%3Crect%20x%3D%228%22%20y%3D%228%22%20width%3D%2248%22%20height%3D%2248%22%20rx%3D%224%22%20fill%3D%22%23fffdf7%22%20stroke%3D%22%23151515%22%20stroke-width%3D%225%22%2F%3E%3Cpath%20d%3D%22M32%2016%2051%2048H13Z%22%20fill%3D%22%23e69f00%22%20stroke%3D%22%23151515%22%20stroke-width%3D%224%22%20stroke-linejoin%3D%22round%22%2F%3E%3C%2Fsvg%3E">
<link rel="shortcut icon" type="image/svg+xml" href="data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2064%2064%22%3E%3Crect%20x%3D%228%22%20y%3D%228%22%20width%3D%2248%22%20height%3D%2248%22%20rx%3D%224%22%20fill%3D%22%23fffdf7%22%20stroke%3D%22%23151515%22%20stroke-width%3D%225%22%2F%3E%3Cpath%20d%3D%22M32%2016%2051%2048H13Z%22%20fill%3D%22%23e69f00%22%20stroke%3D%22%23151515%22%20stroke-width%3D%224%22%20stroke-linejoin%3D%22round%22%2F%3E%3C%2Fsvg%3E">
"""
SAMPLE_JSON = """{
"schema_version": "packing-benchmark/v1",
"case": "triincir@3",
"item": {"type": "regular_polygon", "sides": 3, "side_length": 1},
"container": {"type": "circle", "radius": 0.9535486885675039},
"placements": [
{"x": -0.48390173508543094, "y": -0.09165750515220272, "rotation_radians": 2.1788614979094425},
{"x": 0.3742168507072296, "y": 0.03886972736029847, "rotation_radians": 2.1788160455636896},
{"x": -0.23841900077460812, "y": 0.43093650446493803, "rotation_radians": 3.2260428170876376}
]
}"""
CIRCLE_SQUARE_JSON = """{
"schema_version": "packing-benchmark/v1",
"case": "cirinsqu@4",
"item": {"type": "circle", "radius": 0.5},
"container": {"type": "rectangle", "width": 2.0, "height": 2.0},
"placements": [
{"x": -0.5, "y": -0.5, "rotation_radians": 0.0},
{"x": 0.5, "y": -0.5, "rotation_radians": 0.0},
{"x": -0.5, "y": 0.5, "rotation_radians": 0.0},
{"x": 0.5, "y": 0.5, "rotation_radians": 0.0}
]
}"""
RECTANGLE_JSON = """{
"schema_version": "packing-benchmark/v1",
"case": "rectinrect@2",
"item": {"type": "rectangle", "width": 2.0, "height": 1.0},
"container": {"type": "rectangle", "width": 2.0, "height": 2.0},
"placements": [
{"x": 0.0, "y": -0.5, "rotation_radians": 0.0},
{"x": 0.0, "y": 0.5, "rotation_radians": 0.0}
]
}"""
PYTHON_GENERATOR_SNIPPET = """import json
def placement(x, y, rotation=0.0):
return {"x": float(x), "y": float(y), "rotation_radians": float(rotation)}
solution = {
"schema_version": "packing-benchmark/v1",
"case": "cirinsqu@4",
"item": {"type": "circle", "radius": 0.5},
"container": {"type": "rectangle", "width": 2.0, "height": 2.0},
"placements": [
placement(-0.5, -0.5),
placement(0.5, -0.5),
placement(-0.5, 0.5),
placement(0.5, 0.5),
],
}
print(json.dumps(solution, indent=2))"""
JAVASCRIPT_GENERATOR_SNIPPET = """const placement = (x, y, rotation = 0) => ({
x,
y,
rotation_radians: rotation,
});
const solution = {
schema_version: "packing-benchmark/v1",
case: "rectinrect@2",
item: {type: "rectangle", width: 2.0, height: 1.0},
container: {type: "rectangle", width: 2.0, height: 2.0},
placements: [
placement(0, -0.5),
placement(0, 0.5),
],
};
console.log(JSON.stringify(solution, null, 2));"""
SCHEMA_TEXT = """Canonical submission JSON:
{
"schema_version": "packing-benchmark/v1",
"case": "triintri@1",
"item": {
"type": "regular_polygon",
"sides": 3,
"side_length": 1
},
"container": {
"type": "regular_polygon",
"sides": 3,
"side_length": 1,
"orientation_radians": 0
},
"placements": [
{"x": 0, "y": 0, "rotation_radians": 0}
]
}
Supported shapes:
- regular_polygon: sides plus side_length or circumradius
- circle: radius or diameter
- rectangle: width and height
If redundant dimensions are included, they must agree. For example,
side_length and circumradius must describe the same regular polygon.
The metric is computed from the geometry that is actually verified.
Coordinate convention:
- origin at the container center
- item placements are item centers
- rotations are radians counterclockwise
- touching is legal; overlap and protrusion are rejected
"""
EXAMPLES_MD = f"""### How Submission Works
Paste one canonical coordinate JSON object, click **Verify**, then click **Submit Entry** if it passes.
The geometry tolerance is fixed by the evaluator and is not user-selectable. For an existing case, a submission must improve the current top metric by at least `0.0001` to be accepted as a new record. Cases with no current record can be submitted through `n = {SUBMISSION_MAX_NEW_CASE_N}`. In these tables, smaller metric values are better.
### Test Locally With The Open Verifier
The verifier code is public at [{VERIFIER_REPO_URL}]({VERIFIER_REPO_URL}). It is dependency-free Python and exposes the same geometry check used by this Space.
```bash
python -m pip install git+{VERIFIER_REPO_URL}.git
packing-verifier verify solution.json
packing-verifier verify solution.json --json
```
The local verifier checks geometry and reports the leaderboard metric. The Space still applies the live record gate when you submit: existing cases must improve the current top metric by at least `0.0001`.
### Three Triangles In A Circle Example
This prefilled example is a verified `triincir@3` coordinate layout and a good shape for checking the schema:
```json
{SAMPLE_JSON}
```
### Submission Checklist
- The `case` suffix must match the number of placements, for example `triincir@3` has three placements.
- Use container-centered coordinates.
- Use radians for `rotation_radians`.
- Click **Verify** before submitting; the preview is rendered from the same canonical JSON that is archived.
- Existing cases must beat the current top metric by at least `0.0001`.
- Cases with no current record can be submitted when `n <= {SUBMISSION_MAX_NEW_CASE_N}`.
"""
SCHEMA_DOCS_MD = """### Canonical Fields
Required top-level fields:
```json
{
"case": "triintri@1",
"item": {"type": "regular_polygon", "sides": 3, "side_length": 1},
"container": {"type": "regular_polygon", "sides": 3, "side_length": 1},
"placements": [{"x": 0, "y": 0, "rotation_radians": 0}]
}
```
Supported shape specs:
- `regular_polygon`: `sides` plus `side_length` or `circumradius`
- `circle`: `radius` or `diameter`
- `rectangle`: `width` and `height`
The verifier uses a fixed geometry tolerance. Existing cases must improve the current top metric by at least `0.0001` before they can be submitted as records. Cases with no current record can be submitted through `n = 100`.
""" + f"""
### Four Circles In A Square
```json
{CIRCLE_SQUARE_JSON}
```
### Two Rectangles In A Rectangle
```json
{RECTANGLE_JSON}
```
"""
MONTHS = (
"January",
"February",
"March",
"April",
"May",
"June",
"July",
"August",
"September",
"October",
"November",
"December",
)
def esc(value: Any) -> str:
return html.escape("" if value is None else str(value), quote=True)
def code_block(code: str, language: str = "json") -> str:
return f'<pre class="code-block"><code data-language="{esc(language)}">{esc(code)}</code></pre>'
def submission_guide_html() -> str:
return f"""
<div class="submission-guide">
<div class="guide-grid">
<section class="guide-card wide">
<h3>Canonical Coordinate JSON</h3>
<p>
A submission is one JSON object. The container is centered at the origin, every placement is an item center,
rotations are counterclockwise radians, and the number after <code>@</code> in <code>case</code> must match
the number of placements.
</p>
<ul>
<li><strong>regular_polygon</strong>: use <code>sides</code> plus <code>side_length</code> or <code>circumradius</code>.</li>
<li><strong>circle</strong>: use <code>radius</code> or <code>diameter</code>.</li>
<li><strong>rectangle</strong>: use <code>width</code> and <code>height</code>. Use this for square containers too.</li>
</ul>
<p>
Redundant dimensions must agree. If both <code>side_length</code> and <code>circumradius</code> are present,
the verifier rejects the JSON unless they describe the same polygon.
</p>
{code_block(SAMPLE_JSON)}
</section>
<section class="guide-card">
<h3>Example: Four Circles In A Square</h3>
<p>This is a compact sanity check for circle placements and square containers.</p>
{code_block(CIRCLE_SQUARE_JSON)}
</section>
<section class="guide-card">
<h3>Example: Two Rectangles</h3>
<p>Rectangles use the same center and rotation convention as polygons.</p>
{code_block(RECTANGLE_JSON)}
</section>
<section class="guide-card">
<h3>Generate JSON With Python</h3>
<p>Use this pattern when exporting coordinates from a solver or notebook.</p>
{code_block(PYTHON_GENERATOR_SNIPPET, "python")}
</section>
<section class="guide-card">
<h3>Generate JSON With JavaScript</h3>
<p>This produces the same canonical shape from a browser, Node script, or visualization tool.</p>
{code_block(JAVASCRIPT_GENERATOR_SNIPPET, "javascript")}
</section>
</div>
</div>
"""
def setup_title(setup: str) -> str:
for record in cached_reference_records():
if record.get("setup") == setup and record.get("title"):
return str(record["title"])
return setup
def setup_updated(setup: str) -> str:
update = cached_family_updates().get(setup)
if isinstance(update, dict):
text = str(update.get("text") or "").strip()
if text:
return text
for record in cached_reference_records():
if record.get("setup") != setup:
continue
meta = record.get("friedman_reference")
if isinstance(meta, dict) and meta.get("family_updated"):
return str(meta["family_updated"])
if record.get("friedman_family_updated"):
return str(record["friedman_family_updated"])
return ""
def setup_update_date_info(setup: str) -> dict[str, Any] | None:
update = cached_family_updates().get(setup)
if isinstance(update, dict):
return update
updated = setup_updated(setup)
return parse_friedman_date_text(updated, "Erich Friedman Packing Center index") if updated else None
@lru_cache(maxsize=96)
def setup_choices() -> list[str]:
choices = {
str(record["setup"])
for record in cached_reference_records()
if record.get("setup")
}
choices.update(
str(record["setup"])
for record in cached_verified_records()
if record.get("verified") and record.get("setup")
)
return sorted(choices, key=lambda setup: (setup_title(setup).lower(), setup.lower()))
def is_analytical(record: dict[str, Any]) -> bool:
text = f"{record.get('reference_text', '')} {record.get('metric_expression', '')}".lower()
expression = str(record.get("metric_expression") or "")
exact_tokens = ("√", "pi", "π", "cos", "sin", "tan", "/", "^")
proof_tokens = ("trivial", "proved", "proven", "optimal")
return any(token in text for token in proof_tokens) or any(token in expression.lower() for token in exact_tokens)
def effective_record_date(record: dict[str, Any]) -> dict[str, Any]:
info = record.get("record_date")
if isinstance(info, dict):
return info
if record.get("record_type") == "reference" or record.get("frontend_seed") or is_trivial_record(record):
return date_from_friedman_record(record)
return date_from_submission(record)
def display_date(record: dict[str, Any]) -> str:
return display_date_info(effective_record_date(record))
def record_date_with_source(record: dict[str, Any]) -> str:
info = effective_record_date(record)
text = display_date_info(info)
source = str(info.get("source") or "").strip() if isinstance(info, dict) else ""
if source and text != "date not listed":
return f"{esc(text)} <span class=\"date-source\">({esc(source)})</span>"
return esc(text)
def is_recent_record(record: dict[str, Any]) -> bool:
return is_recent_date_info(effective_record_date(record))
def friedman_reference(record: dict[str, Any]) -> dict[str, Any]:
meta = record.get("friedman_reference")
if isinstance(meta, dict):
return meta
return {
"title": record.get("title") or record.get("friedman_title"),
"metric_symbol": record.get("metric_symbol") or record.get("friedman_metric_symbol"),
"metric_value": record.get("metric_value") or record.get("friedman_metric_value"),
"metric_expression": record.get("metric_expression") or record.get("friedman_metric_expression"),
"credit": record.get("submitted_by") or record.get("friedman_credit"),
"date": record.get("friedman_date"),
"source_page": record.get("source_url") or record.get("friedman_source_url"),
"source_image": record.get("source_image") or record.get("friedman_source_image"),
"source_image_url": record.get("external_image_url") or record.get("friedman_external_image_url"),
"reference_text": record.get("reference_text") or record.get("friedman_reference_text"),
"analytical_or_proved": is_analytical(record),
}
def reference_date(record: dict[str, Any]) -> str:
meta = friedman_reference(record)
date = str(meta.get("date") or "").strip()
if date:
return date
return display_date({"reference_text": meta.get("reference_text", "")})
def reference_credit(record: dict[str, Any]) -> str:
meta = friedman_reference(record)
return str(meta.get("credit") or "unknown").strip() or "unknown"
def source_image_name(record: dict[str, Any]) -> str:
meta = friedman_reference(record)
return str(meta.get("source_image") or "").strip()
def author_name(record: dict[str, Any]) -> str:
return str(record.get("submitted_by") or "unknown").strip() or "unknown"
def display_author(record: dict[str, Any]) -> str:
try:
if int(record.get("n") or 0) == 1:
return "Trivial"
except (TypeError, ValueError):
pass
if record.get("record_type") == "reference":
return reference_credit(record)
author = author_name(record)
if record.get("frontend_seed"):
prior = reference_credit(record)
if prior not in {"unknown", "Erich Friedman Packing Center"}:
return prior
return author
def author_credit_html(author: str) -> str:
if author.strip().lower() == "trivial":
return '<span class="trivial-badge">Trivial</span>'
return f"by <strong>{esc(author)}</strong>"
def existing_author_choices() -> list[str]:
seen: dict[str, str] = {}
for record in [*cached_reference_records(), *cached_verified_records()]:
name = display_author(record)
normalized = name.strip()
if not normalized or normalized.lower() in {"unknown", "anonymous"}:
continue
seen.setdefault(normalized.casefold(), normalized)
return sorted(seen.values(), key=lambda value: value.casefold())
def metric_symbol(record: dict[str, Any]) -> str:
return str(record.get("metric_symbol") or "s")
def metric_value(record: dict[str, Any]) -> str:
value = record.get("metric_value")
if value is None:
value = record.get("side")
if value is None:
return "not reported"
try:
return f"{float(value):.5f}"
except (TypeError, ValueError):
return str(value)
def numeric_metric(record: dict[str, Any]) -> float | None:
value = record.get("metric_value")
if value is None:
value = record.get("side")
try:
parsed = float(value)
except (TypeError, ValueError):
return None
return parsed if math.isfinite(parsed) else None
def compact_expression(record: dict[str, Any]) -> str:
expression = str(record.get("metric_expression") or "").strip()
if record.get("metric_value_source") == "exact_expression" and "=" in expression:
value = numeric_metric(record)
if value is not None:
expression = f"{expression.split('=', 1)[0].strip()} = {value:.5f}"
expression = re.sub(r"\s+", " ", expression)
if len(expression) > 92:
expression = expression[:89].rstrip() + "..."
return expression
def shape_points(shape: dict[str, Any]) -> list[tuple[float, float]]:
if shape["kind"] == "circle":
cx, cy = shape["center"]
r = shape["radius"]
return [(cx - r, cy - r), (cx + r, cy + r)]
return list(shape["vertices"])
def inline_solution_svg(solution: dict[str, Any]) -> str:
solution = normalize_solution(solution)
container = make_container_shape(solution["container"])
shapes = [make_item_shape(solution["item"], placement) for placement in solution["placements"]]
points = shape_points(container)
for shape in shapes:
points.extend(shape_points(shape))
xs = [x for x, _ in points]
ys = [y for _, y in points]
minx, maxx = min(xs), max(xs)
miny, maxy = min(ys), max(ys)
span = max(maxx - minx, maxy - miny, 1.0e-9)
pad = span * 0.075
view = f"{minx - pad:.12g} {-maxy - pad:.12g} {maxx - minx + 2 * pad:.12g} {maxy - miny + 2 * pad:.12g}"
item_stroke = max(span / 360.0, 0.004)
container_stroke = item_stroke * 2.2
item_class = item_class_from_spec(solution["item"])
def pts(poly: list[tuple[float, float]]) -> str:
return " ".join(f"{x:.12g},{-y:.12g}" for x, y in poly)
body = [
f'<svg class="packing-svg" viewBox="{view}" preserveAspectRatio="xMidYMid meet" role="img" aria-label="{esc(solution_case(solution))}">',
f" <title>{esc(solution_case(solution))}</title>",
" <g>",
]
for shape in shapes:
if shape["kind"] == "circle":
cx, cy = shape["center"]
body.append(
f' <circle class="shape-item {item_class}" cx="{cx:.12g}" cy="{-cy:.12g}" r="{shape["radius"]:.12g}" stroke-width="{item_stroke:.12g}"/>'
)
else:
body.append(f' <polygon class="shape-item {item_class}" points="{pts(shape["vertices"])}" stroke-width="{item_stroke:.12g}"/>')
if container["kind"] == "circle":
cx, cy = container["center"]
body.append(
f' <circle class="shape-container" cx="{cx:.12g}" cy="{-cy:.12g}" r="{container["radius"]:.12g}" stroke-width="{container_stroke:.12g}"/>'
)
else:
body.append(f' <polygon class="shape-container" points="{pts(container["vertices"])}" stroke-width="{container_stroke:.12g}"/>')
body.extend([" </g>", "</svg>"])
return "\n".join(body)
def source_link(record: dict[str, Any]) -> str:
meta = friedman_reference(record)
url = str(meta.get("source_page") or record.get("source_url") or "").strip()
if not url:
return ""
return f'<a href="{esc(url)}" target="_blank" rel="noopener noreferrer">page</a>'
@lru_cache(maxsize=1)
def coordinate_records_by_case() -> dict[str, dict[str, Any]]:
best: dict[str, dict[str, Any]] = {}
for record in cached_verified_records():
if not record.get("verified") or not record.get("solution_path"):
continue
case = str(record.get("case") or "")
if not case:
continue
value = record.get("metric_value")
if value is None:
value = record.get("side")
try:
metric = float(value)
except (TypeError, ValueError):
metric = float("inf")
current = best.get(case)
current_value = current.get("metric_value") if current else None
if current_value is None and current:
current_value = current.get("side")
try:
current_metric = float(current_value) if current_value is not None else float("inf")
except (TypeError, ValueError):
current_metric = float("inf")
if current is None or metric < current_metric:
best[case] = record
return best
def visual_record_for(record: dict[str, Any], coordinates: dict[str, dict[str, Any]]) -> dict[str, Any]:
visual_record = record
if record.get("record_type") != "verified":
visual_record = coordinates.get(str(record.get("case") or ""), record)
return visual_record
def record_visual(record: dict[str, Any], coordinates: dict[str, dict[str, Any]]) -> str:
visual_record = visual_record_for(record, coordinates)
if visual_record.get("record_type") == "verified" or visual_record.get("verified"):
try:
solution = STORE.solution_for_record(visual_record)
return f'<div class="render-stage verified-stage">{inline_solution_svg(solution)}</div>'
except Exception as exc:
return f'<div class="render-stage verified-stage"><div class="empty-state">render unavailable: {esc(exc)}</div></div>'
return '<div class="render-stage"><div class="placeholder">coordinate JSON not available yet</div></div>'
def download_actions(filename: str) -> str:
safe = esc(filename or "packing-record")
return f"""
<div class="download-actions" aria-label="Download rendering">
<button class="download-btn" type="button" data-download-image="svg" data-download-filename="{safe}">Download SVG</button>
<button class="download-btn" type="button" data-download-image="png" data-download-filename="{safe}">Download PNG</button>
</div>
"""
def detail_row(label: str, value: str) -> str:
value = value.strip()
if not value:
return ""
return f"<dt>{esc(label)}</dt><dd>{value}</dd>"
def metric_text_from_values(symbol: Any, value: Any) -> str:
try:
return f"{esc(symbol or 's')} = {float(value):.5f}"
except (TypeError, ValueError):
return f"{esc(symbol or 's')} = {esc(value)}"
def previous_bests_table(record: dict[str, Any]) -> str:
previous = record.get("previous_bests")
if not isinstance(previous, list) or not previous:
return ""
rows = []
for item in previous:
if not isinstance(item, dict):
continue
date_info = item.get("date")
date_text = display_date_info(date_info if isinstance(date_info, dict) else None)
source_url = str(item.get("source_url") or "").strip()
source = str(item.get("source") or "previous record").strip()
source_cell = f'<a href="{esc(source_url)}" target="_blank" rel="noopener noreferrer">{esc(source)}</a>' if source_url else esc(source)
rows.append(
"<tr>"
f"<td>{esc(item.get('author') or 'unknown')}</td>"
f"<td>{esc(date_text)}</td>"
f"<td>{metric_text_from_values(item.get('metric_symbol') or metric_symbol(record), item.get('metric_value'))}</td>"
f"<td>{source_cell}</td>"
"</tr>"
)
if not rows:
return ""
return (
'<table class="previous-bests-table">'
"<thead><tr><th>Author</th><th>Date</th><th>Metric</th><th>Source</th></tr></thead>"
f"<tbody>{''.join(rows)}</tbody></table>"
)
def visual_provenance(record: dict[str, Any], visual_record: dict[str, Any]) -> str:
source_case = str(visual_record.get("monotone_upper_bound_from_case") or "").strip()
if source_case:
visual_metric = metric_value(visual_record)
shown_metric = metric_value(record)
suffix = ""
if visual_metric != shown_metric:
suffix = f" Coordinate JSON evaluator metric: {esc(metric_symbol(visual_record))} = {esc(visual_metric)}; Friedman reported metric: {esc(metric_symbol(record))} = {esc(shown_metric)}."
return (
f"Verified monotone upper-bound layout derived by deleting items from {esc(source_case)}; "
"the Friedman-listed finder remains credited for this row."
) + suffix
if visual_record.get("frontend_seed"):
visual_metric = metric_value(visual_record)
shown_metric = metric_value(record)
notes = str(visual_record.get("notes") or "").lower()
suffix = ""
if visual_metric != shown_metric:
suffix = f" Coordinate JSON evaluator metric: {esc(metric_symbol(visual_record))} = {esc(visual_metric)}; Friedman reported metric: {esc(metric_symbol(record))} = {esc(shown_metric)}."
if "image-seeded" in notes or "image seeded" in notes:
return "Image-seeded from the Friedman source image and verified for rendering." + suffix
if visual_record is record or visual_record.get("id") == record.get("id"):
return "Verified coordinate layout credited under the public attribution policy." + suffix
return "Verified coordinate rendering for the listed reference." + suffix
if visual_record is record or visual_record.get("id") == record.get("id"):
if visual_record.get("frontend_seed"):
return "Generated verified coordinate layout; no Friedman coordinate record was listed for this case."
return "Submitted coordinate JSON."
return "Coordinate rendering attached to this case."
def display_metric_record(record: dict[str, Any], visual_record: dict[str, Any]) -> dict[str, Any]:
return record
def record_detail_rows(record: dict[str, Any], visual_record: dict[str, Any], source: str, image_name: str, expression: str, analytical: Any) -> list[str]:
rows: list[str] = []
rows.append(detail_row("Rendering", esc(visual_provenance(record, visual_record))))
rows.append(detail_row("Record date", record_date_with_source(record)))
if record.get("record_type") == "reference" and visual_record.get("verified"):
if is_trivial_record(record):
rows.append(
detail_row(
"Coordinate JSON",
"used only for rendering; the exact trivial value is shown as the record",
)
)
else:
rows.append(
detail_row(
"Coordinate JSON",
f"{esc(metric_symbol(visual_record))} = {esc(metric_value(visual_record))} from the stored evaluator",
)
)
rows.append(
detail_row(
"Friedman reference",
f"{esc(metric_symbol(record))} = {esc(metric_value(record))} by {esc(reference_credit(record))}, {esc(reference_date(record))}",
)
)
if record.get("record_type") == "verified":
database_inserted_at = str(record.get("database_inserted_at") or record.get("submitted_at") or "").strip()
database_info = date_from_submission({"submitted_at": database_inserted_at})
rows.append(detail_row("Database entry", esc(display_date_info(database_info))))
notes = str(record.get("notes") or "").strip()
if notes:
rows.append(detail_row("Notes", esc(notes)))
rows.append(detail_row("Previous bests", previous_bests_table(record)))
rows.append(detail_row("Formula", esc(expression)))
if image_name:
rows.append(detail_row("Source image", esc(image_name)))
if source:
rows.append(detail_row("Source", source))
if analytical:
rows.append(detail_row("Status", "analytical/proved"))
reference_text = str(friedman_reference(record).get("reference_text") or "").strip()
rows.append(detail_row("Reference text", esc(reference_text)))
return rows
def record_modal(
record: dict[str, Any],
visual_record: dict[str, Any],
display_record: dict[str, Any],
coordinates: dict[str, dict[str, Any]],
source: str,
image_name: str,
expression: str,
analytical: Any,
anchor: str,
modal_id: str,
visible_author: str,
) -> str:
rows = record_detail_rows(record, visual_record, source, image_name, expression, analytical)
visual_controls = download_actions(str(record.get("case") or modal_id)) if visual_record.get("verified") or visual_record.get("record_type") == "verified" else ""
return f"""
<section class="record-modal" id="{esc(modal_id)}" aria-label="{esc(record.get("case"))} record information">
<a class="modal-backdrop" href="#{esc(anchor)}" aria-label="Close record information"></a>
<div class="modal-panel" role="dialog" aria-modal="true" aria-labelledby="{esc(modal_id)}-title">
<a class="modal-close" href="#{esc(anchor)}" aria-label="Close record information">x</a>
<div class="modal-head">
<div class="modal-case">{esc(record.get("case"))}</div>
<h3 id="{esc(modal_id)}-title">{esc(setup_title(str(record.get("setup") or "")))}</h3>
<div class="modal-subtitle">n={esc(record.get("n"))} {author_credit_html(visible_author)}</div>
</div>
<div class="modal-layout">
<div class="modal-visual">
{record_visual(record, coordinates)}
{visual_controls}
</div>
<div>
<div class="modal-metric">
<strong>{esc(metric_symbol(display_record))} = {esc(metric_value(display_record))}</strong>
<span>{esc(expression)}</span>
</div>
<dl class="modal-details">{''.join(rows)}</dl>
</div>
</div>
</div>
</section>
"""
def record_card(record: dict[str, Any], coordinates: dict[str, dict[str, Any]]) -> str:
verified = record.get("record_type") == "verified"
visual_record = visual_record_for(record, coordinates)
display_record = display_metric_record(record, visual_record)
source = source_link(record)
expression = compact_expression(record)
image_name = source_image_name(record)
analytical = friedman_reference(record).get("analytical_or_proved")
visible_author = display_author(record)
card_class = "verified" if verified else "reference"
if is_recent_record(record):
card_class += " recent-record"
recent = '<span class="recent-dot" title="New in the last 7 days"></span>' if is_recent_record(record) else ""
anchor = f"{record.get('setup')}-{record.get('n')}"
modal_id = f"modal-{anchor}"
return f"""
<article class="record-card {card_class}" id="{esc(anchor)}">
<a class="record-open" href="#{esc(modal_id)}" aria-label="Open {esc(record.get("case"))} record information">
<div class="record-top">
<div class="record-case">{esc(record.get("case"))}{recent}</div>
</div>
{record_visual(record, coordinates)}
<div class="record-body">
<div class="metric"><strong>{esc(metric_symbol(display_record))} = {esc(metric_value(display_record))}</strong><span>n={esc(record.get("n"))}</span></div>
<div class="expression">{esc(expression)}</div>
<div class="record-author">{author_credit_html(visible_author)}</div>
</div>
</a>
</article>
{record_modal(record, visual_record, display_record, coordinates, source, image_name, expression, analytical, anchor, modal_id, visible_author)}
"""
def setup_summary(setup: str) -> dict[str, Any]:
records = cached_public_records(setup, False)
coordinate_count = sum(
1
for record in cached_verified_records()
if record.get("verified") and record.get("solution_path") and record.get("setup") == setup
)
n_values = [int(r.get("n", 0)) for r in records if r.get("n") is not None]
return {
"setup": setup,
"title": setup_title(setup),
"records": records,
"count": len(records),
"verified": sum(1 for r in records if r.get("record_type") == "verified"),
"coordinate_count": coordinate_count,
"analytic": sum(1 for r in records if is_analytical(r)),
"updated": setup_updated(setup),
"updated_recent": is_recent_date_info(setup_update_date_info(setup)),
"n_range": f"{min(n_values)}-{max(n_values)}" if n_values else "not listed",
}
def shape_phrase(code: str, plural: bool = False) -> str:
names = {
"cir": ("circle", "circles"),
"dom": ("domino", "dominoes"),
"tri": ("triangle", "triangles"),
"squ": ("square", "squares"),
"pen": ("regular pentagon", "regular pentagons"),
"hex": ("regular hexagon", "regular hexagons"),
"oct": ("regular octagon", "regular octagons"),
"rect": ("rectangle", "rectangles"),
}
singular, many = names.get(code, (code, code + "s"))
return many if plural else singular
def parse_setup_codes(setup: str) -> tuple[str, str]:
if "in" not in setup:
return setup, ""
return tuple(setup.split("in", 1)) # type: ignore[return-value]
def inner_class(setup: str) -> str:
item_code, _ = parse_setup_codes(setup)
return f"inner-{re.sub(r'[^A-Za-z0-9_-]', '', item_code).lower()}"
def item_class_from_spec(spec: dict[str, Any]) -> str:
kind = str(spec.get("type") or "").strip().lower()
if kind == "regular_polygon":
sides = int(spec.get("sides", 0) or 0)
code = {3: "tri", 4: "squ", 5: "pen", 6: "hex", 8: "oct"}.get(sides, "unknown")
elif kind == "circle":
code = "cir"
elif kind == "rectangle":
width = float(spec.get("width", 0) or 0)
height = float(spec.get("height", 0) or 0)
code = "dom" if width > 0 and height > 0 and abs(max(width, height) / min(width, height) - 2.0) < 1.0e-6 else "squ"
else:
code = "unknown"
return f"inner-{code}"
def family_description(summary: dict[str, Any]) -> str:
item_code, container_code = parse_setup_codes(str(summary["setup"]))
item = shape_phrase(item_code, plural=True)
container = shape_phrase(container_code)
updated = f" Friedman lists this family as updated {esc(summary['updated'])}." if summary.get("updated") else ""
return (
f"This page tracks the smallest known container metric for packing n equal {esc(item)} "
f"inside a {esc(container)}. The number shown on each card is the verified coordinate metric "
f"for current coordinate records, or the listed reference metric when that is the better value. "
f"Click a card to view the coordinate JSON metric, source information, and previous bests.{updated}"
)
def family_preview(setup: str, coordinates: dict[str, dict[str, Any]]) -> str:
record = coordinates.get(f"{setup}@10")
if record is None:
records = [
candidate
for case, candidate in coordinates.items()
if case.startswith(f"{setup}@")
]
records.sort(key=lambda candidate: abs(int(candidate.get("n", 0)) - 10))
record = records[0] if records else None
if record is None:
return '<div class="render-stage family-render"><div class="placeholder">coordinate JSON not available yet</div></div>'
try:
return f'<div class="render-stage family-render">{inline_solution_svg(STORE.solution_for_record(record))}</div>'
except Exception as exc:
return f'<div class="render-stage family-render"><div class="empty-state">render unavailable: {esc(exc)}</div></div>'
def family_card(summary: dict[str, Any], coordinates: dict[str, dict[str, Any]]) -> str:
setup = str(summary["setup"])
cls = inner_class(setup)
recent = '<span class="recent-dot" title="Updated in the last 7 days"></span>' if summary.get("updated_recent") else ""
return f"""
<a class="family-card front-family-card {esc(cls)}" href="?family={esc(setup)}" aria-label="Open {esc(summary["title"])} records">
{family_preview(setup, coordinates)}
<div class="family-card-top">
<div>
<div class="family-code">{esc(setup)}</div>
<h3>{esc(summary["title"])}{recent}</h3>
</div>
</div>
</a>
"""
def front_family_card_html(setup: str, coordinates: dict[str, dict[str, Any]]) -> str:
return family_card({"setup": setup, "title": setup_title(setup)}, coordinates)
def family_rows_html(summaries: list[dict[str, Any]], coordinates: dict[str, dict[str, Any]]) -> str:
container_order = {"tri": 0, "squ": 1, "pen": 2, "hex": 3, "oct": 4, "cir": 5, "dom": 6}
rows: dict[str, list[dict[str, Any]]] = {}
for summary in summaries:
_, container_code = parse_setup_codes(str(summary["setup"]))
rows.setdefault(container_code, []).append(summary)
body = []
for container_code in sorted(rows, key=lambda code: (container_order.get(code, 99), shape_phrase(code))):
cards = "".join(
family_card(summary, coordinates)
for summary in sorted(rows[container_code], key=lambda item: (parse_setup_codes(str(item["setup"]))[0], str(item["setup"])))
)
body.append(
f"""
<section class="family-row">
<div class="family-grid">{cards}</div>
</section>
"""
)
return f'<div class="family-matrix">{"".join(body)}</div>'
@lru_cache(maxsize=96)
def family_page_html(setup: str | None = None) -> str:
choices = setup_choices()
setup = setup if setup in choices else (choices[0] if choices else "")
summary = setup_summary(setup) if setup else {"records": [], "setup": "", "title": ""}
coordinates = coordinate_records_by_case()
setup = str(summary["setup"])
records = summary["records"]
cards = "".join(record_card(record, coordinates) for record in records)
return f"""
<main class="packing-shell">
{top_nav("home")}
<section class="section">
<div class="contain">
<div class="family-title-card">
<div>
<div class="family-code">{esc(setup)}</div>
<h2>{esc(summary["title"])}</h2>
<p class="family-subtitle">{family_description(summary)}</p>
</div>
</div>
<div class="record-grid">{cards}</div>
</div>
</section>
</main>
"""
def top_nav(active: str = "home") -> str:
def nav_class(route: str, extra: str = "") -> str:
classes = ["site-nav-link"]
if route == active:
classes.append("active")
if extra:
classes.append(extra)
return " ".join(classes)
return f"""
<nav class="site-nav" aria-label="Site navigation">
<a class="{nav_class("home")}" href="/" data-route="home">Home</a>
<a class="{nav_class("leaderboard")}" href="#leaderboard-panel" data-route="leaderboard">Leaderboard</a>
<a class="{nav_class("submit", "submit-link")}" href="#submit-entry-panel" data-route="submit">Submit Entry</a>
</nav>
"""
@lru_cache(maxsize=4)
def directory_html() -> str:
choices = setup_choices()
summaries = [setup_summary(setup) for setup in choices]
coordinates = coordinate_records_by_case()
family_rows = family_rows_html(summaries, coordinates)
return f"""
<main class="packing-shell" id="top">
{top_nav("home")}
<section class="hero-stage">
<div class="contain">
<div>
<h1>Packing Benchmark</h1>
<p class="hero-copy">
verified shape packing records, heavily inspired by
<a href="https://erich-friedman.github.io/packing/index.html" target="_blank" rel="noopener noreferrer">Erich Friedman's Packing Center</a>.
</p>
</div>
</div>
</section>
<section class="section" id="families">
<div class="contain">
<div class="section-head">
<div>
<h2>Choose a family</h2>
<p class="section-note">
Choose a family to view its verified packing records.
</p>
</div>
</div>
{family_rows}
</div>
</section>
</main>
"""
def browse_html() -> str:
return directory_html()
def loading_html() -> str:
return """
<main class="packing-shell">
<nav class="site-nav" aria-label="Site navigation">
<a class="site-nav-link active" href="/" data-route="home">Home</a>
<a class="site-nav-link" href="#leaderboard-panel" data-route="leaderboard">Leaderboard</a>
<a class="site-nav-link submit-link" href="#submit-entry-panel" data-route="submit">Submit Entry</a>
</nav>
<section class="hero-stage">
<div class="contain">
<h1>Packing Benchmark</h1>
<p class="hero-copy">Loading records...</p>
</div>
</section>
</main>
"""
def home_page_for_request(request: gr.Request):
try:
query = dict(request.query_params) if request else {}
except Exception:
query = {}
setup = str(query.get("family") or "").strip()
if setup in setup_choices():
return family_page_html(setup)
return gr.update()
def condensed_case_links(cases: list[str]) -> str:
grouped: dict[str, list[int]] = {}
for case in cases:
if "@" not in case:
continue
setup, n_text = case.rsplit("@", 1)
try:
n = int(n_text)
except ValueError:
continue
grouped.setdefault(setup, []).append(n)
links = []
for setup in sorted(grouped, key=lambda value: (setup_title(value).lower(), value)):
values = sorted(set(grouped[setup]))
n_text = ",".join(str(value) for value in values)
label = f"{setup}@{{{n_text}}}"
href = f"?family={setup}#{setup}-{values[0]}"
links.append(f'<a href="{esc(href)}">{esc(label)}</a>')
return '<div class="case-links">' + "; ".join(links) + "</div>"
def slug_id(value: str) -> str:
slug = re.sub(r"[^a-z0-9]+", "-", value.lower()).strip("-")
return slug or "author"
def sorted_case_names(cases: list[str]) -> list[str]:
def key(case: str) -> tuple[str, int, str]:
if "@" not in case:
return (case.lower(), -1, case)
setup, n_text = case.rsplit("@", 1)
try:
n = int(n_text)
except ValueError:
n = -1
return (setup_title(setup).lower(), n, case)
return sorted(set(cases), key=key)
def case_link(case: str) -> str:
if "@" not in case:
return esc(case)
setup, n_text = case.rsplit("@", 1)
href = f"?family={setup}#{setup}-{n_text}"
return f'<a href="{esc(href)}">{esc(case)}</a>'
SHAPE_CLASS_ORDER = ("tri", "squ", "pen", "hex", "oct", "cir", "dom", "rect")
def shape_class_sort_key(code: str) -> tuple[int, str]:
try:
index = SHAPE_CLASS_ORDER.index(code)
except ValueError:
index = len(SHAPE_CLASS_ORDER)
return (index, shape_phrase(code, plural=True))
def leaderboard_shape_label(code: str) -> str:
return shape_phrase(code, plural=True).replace("regular ", "")
def setup_item_code(record: dict[str, Any]) -> str:
setup = str(record.get("setup") or "")
if not setup and record.get("case") and "@" in str(record.get("case")):
setup = str(record["case"]).split("@", 1)[0]
item_code, _ = parse_setup_codes(setup)
return item_code or "other"
def leaderboard_class_columns(rows: dict[str, dict[str, Any]]) -> list[str]:
codes = {
str(code)
for stats in rows.values()
for code, count in dict(stats.get("class_counts", {})).items()
if int(count) > 0
}
return sorted(codes, key=shape_class_sort_key)
def leaderboard_author_modal(author: str, stats: dict[str, Any], rank: int, modal_id: str) -> str:
cases = sorted_case_names([str(case) for case in stats.get("cases", [])])
family_count = len({case.rsplit("@", 1)[0] for case in cases if "@" in case})
all_links = "".join(case_link(case) for case in cases)
grouped_links = condensed_case_links(cases)
class_counts = dict(stats.get("class_counts", {}))
class_badges = "".join(
f'<span><strong>{int(class_counts.get(code, 0))}</strong>{esc(leaderboard_shape_label(code))}</span>'
for code in sorted(class_counts, key=shape_class_sort_key)
if int(class_counts.get(code, 0)) > 0
)
return f"""
<section class="record-modal leaderboard-modal" id="{esc(modal_id)}" aria-label="{esc(author)} leaderboard details">
<a class="modal-backdrop" href="#leaderboard-table" aria-label="Close leaderboard details"></a>
<div class="modal-panel" role="dialog" aria-modal="true" aria-labelledby="{esc(modal_id)}-title">
<a class="modal-close" href="#leaderboard-table" aria-label="Close leaderboard details">x</a>
<div class="modal-head">
<div class="modal-case">Leaderboard</div>
<h3 id="{esc(modal_id)}-title">{esc(author)}</h3>
<div class="modal-subtitle">Rank #{rank}</div>
</div>
<div class="modal-layout">
<div>
<div class="leaderboard-stat-grid">
<div class="leaderboard-stat"><strong>{int(stats["total_top"])}</strong><span>total top records</span></div>
<div class="leaderboard-stat"><strong>{int(stats["verified"])}</strong><span>verified submissions</span></div>
<div class="leaderboard-stat"><strong>{family_count}</strong><span>families</span></div>
</div>
<div class="leaderboard-class-strip">{class_badges}</div>
{grouped_links}
<div class="leaderboard-full-list" aria-label="Complete record list">{all_links}</div>
</div>
</div>
</div>
</section>
"""
def leaderboard_html() -> str:
rows: dict[str, dict[str, Any]] = {}
coordinates = coordinate_records_by_case()
for record in cached_public_records("", False):
author = display_author(record)
if author.strip().lower() == "trivial":
continue
entry = rows.setdefault(author, {"total_top": 0, "verified": 0, "cases": [], "class_counts": {}})
entry["total_top"] += 1
item_code = setup_item_code(record)
entry["class_counts"][item_code] = int(entry["class_counts"].get(item_code, 0)) + 1
if record.get("record_type") == "verified":
entry["verified"] += 1
entry["cases"].append(str(record.get("case")))
class_columns = leaderboard_class_columns(rows)
class_headers = "".join(f"<th>{esc(leaderboard_shape_label(code).title())}</th>" for code in class_columns)
total_top_max = max((int(stats["total_top"]) for stats in rows.values()), default=0)
class_maxima = {
code: max((int(dict(stats.get("class_counts", {})).get(code, 0)) for stats in rows.values()), default=0)
for code in class_columns
}
sorted_rows = sorted(rows.items(), key=lambda item: (-int(item[1]["total_top"]), item[0].lower()))
body_parts = []
modal_parts = []
for rank, (author, stats) in enumerate(sorted_rows, start=1):
modal_id = f"leaderboard-author-{rank}-{slug_id(author)}"
total_top = int(stats["total_top"])
total_cell_class = ' class="leaderboard-best"' if total_top == total_top_max and total_top > 0 else ""
class_cells = "".join(
(
f'<td class="leaderboard-best"><strong>{value}</strong></td>'
if value == class_maxima.get(code, 0) and value > 0
else f"<td>{value}</td>"
)
for code in class_columns
for value in [int(dict(stats.get("class_counts", {})).get(code, 0))]
)
body_parts.append(
f"""
<tr>
<td>{rank}</td>
<td><a class="leaderboard-author-link" href="#{esc(modal_id)}"><strong>{esc(author)}</strong></a></td>
<td{total_cell_class}>{f"<strong>{total_top}</strong>" if total_cell_class else total_top}</td>
{class_cells}
</tr>
"""
)
modal_parts.append(leaderboard_author_modal(author, stats, rank, modal_id))
body = "\n".join(body_parts)
modals = "\n".join(modal_parts)
return f"""
<main class="packing-shell">
{top_nav("leaderboard")}
<section class="section">
<div class="contain">
<div class="section-head">
<div>
<h2>Leaderboard</h2>
</div>
</div>
<table class="leaderboard-table" id="leaderboard-table">
<thead>
<tr><th>#</th><th>Author</th><th>Total top</th>{class_headers}</tr>
</thead>
<tbody>{body}</tbody>
</table>
{modals}
</div>
</section>
</main>
"""
def submit_schema_intro_html() -> str:
return f"""
<main class="packing-shell">
{top_nav("submit")}
<section class="section submit-hero">
<div class="contain">
<div class="section-head">
<div>
<h2>Submit Entry</h2>
<p class="section-note">
Paste one canonical coordinate JSON object. Existing cases must beat the current top metric by at least 0.0001; new no-record cases are accepted through n={SUBMISSION_MAX_NEW_CASE_N}.
The open-source local verifier is available at <a href="{esc(VERIFIER_REPO_URL)}" target="_blank" rel="noopener noreferrer">github.com/Nathan-Roll1/packing-verifier</a>.
</p>
</div>
</div>
</div>
</section>
</main>
"""
def load_submission(json_text: str) -> dict[str, Any]:
if not json_text or not json_text.strip():
raise ValueError("Paste canonical coordinate JSON.")
return load_solution_json(json_text)
def record_metric_float(record: dict[str, Any]) -> float | None:
value = record.get("metric_value")
if value is None:
value = record.get("side")
try:
metric = float(value)
except (TypeError, ValueError):
return None
return metric if math.isfinite(metric) else None
def current_top_for_case(case: str) -> dict[str, Any] | None:
candidates = [record for record in cached_public_records("", False) if str(record.get("case")) == case]
candidates = [record for record in candidates if record_metric_float(record) is not None]
if not candidates:
return None
return min(candidates, key=lambda record: record_metric_float(record) or float("inf"))
def submitted_metric_for_result(result: dict[str, Any], current: dict[str, Any] | None) -> tuple[str, float | None]:
symbol = str(result.get("metric_symbol") or (current or {}).get("metric_symbol") or "s")
try:
metric = float(result.get("metric_value"))
except (TypeError, ValueError):
try:
side = float(result.get("side"))
except (TypeError, ValueError):
return symbol, None
metric = side * 0.5 if symbol == "r" else side
if not math.isfinite(metric):
return symbol, None
return symbol, metric
def submission_gate(result: dict[str, Any]) -> tuple[bool, str]:
if not result.get("ok"):
return False, "Geometry verification failed."
try:
submitted_n = int(result.get("n") or 0)
except (TypeError, ValueError):
return False, "The evaluator could not determine the number of submitted items."
current = current_top_for_case(str(result.get("case") or ""))
symbol, submitted_metric = submitted_metric_for_result(result, current)
if submitted_metric is None:
return False, "The evaluator could not compute a submitted metric."
if current is None:
if submitted_n > SUBMISSION_MAX_NEW_CASE_N:
return (
False,
f"No current top record exists for this case, and new no-record cases are accepted only through n={SUBMISSION_MAX_NEW_CASE_N}.",
)
return True, f"No current top record exists for this case; valid new cases can be submitted through n={SUBMISSION_MAX_NEW_CASE_N}."
current_symbol = str(current.get("metric_symbol") or symbol)
if current_symbol != symbol:
return False, f"Submitted metric symbol {symbol!r} does not match current record metric symbol {current_symbol!r}."
current_metric = record_metric_float(current)
if current_metric is None:
return True, "No comparable current top metric exists; a valid geometry can be submitted."
improvement = current_metric - submitted_metric
if improvement >= SUBMISSION_MIN_IMPROVEMENT:
return (
True,
f"Improves the current top {symbol} metric by {improvement:.10f}; required improvement is at least {SUBMISSION_MIN_IMPROVEMENT:.4f}.",
)
return (
False,
f"Current top {symbol} metric is {current_metric:.10f}. Submitted {symbol} metric is {submitted_metric:.10f}. "
f"Improvement is {improvement:.10f}; required improvement is at least {SUBMISSION_MIN_IMPROVEMENT:.4f}.",
)
def result_markdown(result: dict[str, Any], gate: tuple[bool, str] | None = None) -> str:
if result["ok"]:
metric_symbol_text = result.get("metric_symbol") or "s"
metric_value_text = result.get("metric_value")
try:
metric_line = f"- Container metric: `{metric_symbol_text} = {float(metric_value_text):.10f}`\n"
except (TypeError, ValueError):
metric_line = ""
text = (
"### Verification Passed\n\n"
f"- Case: `{result['case']}`\n"
f"- Items: `{result['n']}`\n"
f"{metric_line}"
f"- Container side/diameter: `{result['side']:.10f}`\n"
f"- Density: `{result['density']:.6f}`\n"
f"- Max boundary excess: `{result['max_boundary_excess']:.3e}`\n"
f"- Max pair overlap depth: `{result['max_pair_overlap_depth']:.3e}`\n"
)
if gate is not None:
passed, message = gate
status = "Passed" if passed else "Needs improvement"
text += f"\n### Record Gate\n\n- Status: `{status}`\n- {message}\n"
return text
errors = "\n".join(f"- {e}" for e in result["errors"])
return "### Verification Failed\n\n" + errors
def empty_report_markdown() -> str:
return f"### Ready To Verify\n\nPaste canonical JSON, then run the verifier. Existing cases must improve the current top metric by at least `0.0001`; cases with no current record can be submitted through `n = {SUBMISSION_MAX_NEW_CASE_N}`."
def empty_preview_html() -> str:
return """
<div class="preview-card">
<div class="render-stage">
<div class="placeholder">verified geometry preview</div>
</div>
</div>
"""
def supported_gradio_kwargs(component: Any, **kwargs: Any) -> dict[str, Any]:
try:
parameters = inspect.signature(component.__init__).parameters
except (TypeError, ValueError):
return kwargs
return {key: value for key, value in kwargs.items() if key in parameters}
def supported_call_kwargs(callable_obj: Any, **kwargs: Any) -> dict[str, Any]:
try:
parameters = inspect.signature(callable_obj).parameters
except (TypeError, ValueError):
return {}
return {key: value for key, value in kwargs.items() if key in parameters}
def preview_html(solution: dict[str, Any]) -> str:
filename = solution_case(solution) or "submission-preview"
return f"""
<div class="preview-card">
<div class="render-stage verified-stage">{inline_solution_svg(solution)}</div>
{download_actions(filename)}
</div>
"""
def verify_only(json_text: str):
try:
solution = normalize_solution(load_submission(json_text))
result = verify_solution(solution, tolerance=DEFAULT_TOLERANCE).as_dict()
gate = submission_gate(result) if result["ok"] else None
pretty = json.dumps(solution, indent=2, sort_keys=True)
preview = preview_html(solution) if result["ok"] else ""
return result_markdown(result, gate), preview, pretty
except Exception as exc:
return f"### Verification Failed\n\n- {exc}", empty_preview_html(), json_text
def submit_solution(
json_text: str,
submitter: str,
notes: str,
source_url: str,
):
try:
solution = normalize_solution(load_submission(json_text))
preflight = verify_solution(solution, tolerance=DEFAULT_TOLERANCE).as_dict()
gate_ok, gate_message = submission_gate(preflight)
if not gate_ok:
return (
result_markdown(preflight, (gate_ok, gate_message)),
preview_html(solution),
json.dumps(solution, indent=2, sort_keys=True),
gr.update(),
gr.update(),
gr.update(),
)
record, result = STORE.append_verified_submission(
solution,
submitter=submitter,
notes=notes,
source_url=source_url,
tolerance=DEFAULT_TOLERANCE,
)
stored = STORE.solution_for_record(record)
pretty = json.dumps(stored, indent=2, sort_keys=True)
sync_status = record.get("sync_status", "dataset sync disabled")
clear_page_caches()
current = current_top_for_case(str(record.get("case") or result.get("case") or ""))
leaderboard_updated = bool(current and str(current.get("id")) == str(record.get("id")))
leaderboard_status = (
f"\n\n### Leaderboard Updated\n\nRecord `{record['id']}` is now the current public top for `{record['case']}`."
if leaderboard_updated
else (
"\n\n### Leaderboard Not Changed\n\n"
"The entry was archived, but another row is still the current public top for this case."
)
)
message = (
result_markdown(result, (gate_ok, gate_message))
+ f"\n\nSaved as record `{record['id']}`."
+ leaderboard_status
+ f"\n\nDataset sync: `{sync_status}`."
)
refreshed_home = family_page_html(str(record.get("setup") or result.get("setup") or "")) if record.get("setup") or result.get("setup") else directory_html()
return (
message,
preview_html(stored),
pretty,
leaderboard_html(),
gr.update(choices=existing_author_choices(), value=submitter),
refreshed_home,
)
except Exception as exc:
return f"### Submission Rejected\n\n- {exc}", empty_preview_html(), json_text, gr.update(), gr.update(), gr.update()
THEME = gr.themes.Base()
def prewarm_pages() -> None:
directory_html()
for setup in setup_choices():
family_page_html(setup)
with gr.Blocks(
**supported_gradio_kwargs(
gr.Blocks,
title="Packing Benchmark",
analytics_enabled=False,
head=APP_HEAD,
footer_links=[],
)
) as demo:
browse_page = gr.HTML(directory_html(), elem_id="home-panel")
leaderboard_page = gr.HTML(leaderboard_html(), elem_id="leaderboard-panel")
with gr.Group(elem_id="submit-entry-panel", elem_classes=["submit-entry-panel"]):
gr.HTML(submit_schema_intro_html())
with gr.Group(elem_classes=["submit-shell"]):
with gr.Row(elem_classes=["submit-layout"]):
with gr.Column(scale=7, elem_classes=["submit-editor"]):
with gr.Group(elem_classes=["submit-panel"]):
gr.HTML('<div class="submit-panel-title">Paste JSON</div>')
gr.HTML(f'<p class="submit-panel-note">Paste one canonical coordinate JSON object. The evaluator uses a fixed tolerance, requires a 0.0001 metric improvement for existing cases, and accepts new no-record cases through n={SUBMISSION_MAX_NEW_CASE_N}.</p>')
json_code = gr.Textbox(
**supported_gradio_kwargs(
gr.Textbox,
value=SAMPLE_JSON,
label="Coordinate JSON",
lines=18,
max_lines=30,
show_copy_button=True,
)
)
with gr.Column(scale=5, elem_classes=["submit-meta"]):
with gr.Group(elem_classes=["submit-panel"]):
gr.HTML('<div class="submit-panel-title">Author</div>')
gr.HTML('<p class="submit-panel-note">Choose an existing credited author or type a new name.</p>')
submitter = gr.Dropdown(
**supported_gradio_kwargs(
gr.Dropdown,
choices=existing_author_choices(),
label="Author",
value=None,
allow_custom_value=True,
filterable=True,
info="Start typing to search existing authors. New names are accepted.",
)
)
source_url = gr.Textbox(label="Source URL", placeholder="Optional")
notes = gr.Textbox(label="Notes", lines=3, placeholder="Optional method or provenance note")
with gr.Row(elem_classes=["submit-actions"]):
verify_btn = gr.Button("Verify", variant="secondary")
submit_btn = gr.Button("Submit Entry", variant="primary")
with gr.Row(elem_classes=["submit-layout"]):
with gr.Column(scale=5, elem_classes=["submit-results"]):
with gr.Group(elem_classes=["submit-results-card"]):
gr.HTML('<div class="submit-panel-title">Verification</div>')
report = gr.Markdown(value=empty_report_markdown(), elem_classes=["verification-report"])
with gr.Column(scale=4, elem_classes=["submit-results"]):
with gr.Group(elem_classes=["submit-results-card"]):
gr.HTML('<div class="submit-panel-title">Preview</div>')
preview = gr.HTML(value=empty_preview_html(), label="Browser render")
with gr.Column(scale=5, elem_classes=["submit-results"]):
with gr.Group(elem_classes=["submit-results-card"]):
with gr.Accordion("Normalized JSON", open=False):
normalized_json = gr.Textbox(
**supported_gradio_kwargs(
gr.Textbox,
label="Verifier-normalized payload",
lines=12,
show_copy_button=True,
)
)
with gr.Group(elem_classes=["submit-docs"]):
with gr.Accordion("Submission Documentation", open=False):
gr.Markdown(EXAMPLES_MD + "\n\n" + SCHEMA_DOCS_MD)
demo.load(home_page_for_request, outputs=[browse_page], show_progress="hidden")
verify_btn.click(verify_only, inputs=[json_code], outputs=[report, preview, normalized_json])
submit_btn.click(
submit_solution,
inputs=[json_code, submitter, notes, source_url],
outputs=[report, preview, normalized_json, leaderboard_page, submitter, browse_page],
)
if __name__ == "__main__":
demo.launch(
theme=THEME,
css=CSS,
js=APP_JS,
server_name="0.0.0.0",
ssr_mode=False,
**supported_call_kwargs(demo.launch, show_api=False, footer_links=[], favicon_path=str(FAVICON_PATH)),
)
|