Skip to content

Commit

Permalink
Merge pull request #164 from thearyadev/163-season-9-preliminary-data
Browse files Browse the repository at this point in the history
163 season 9 preliminary data
  • Loading branch information
thearyadev authored Feb 28, 2024
2 parents 64b290a + d8c4d06 commit f8abc92
Show file tree
Hide file tree
Showing 5 changed files with 434 additions and 34 deletions.
33 changes: 31 additions & 2 deletions archive/latest.sql

Large diffs are not rendered by default.

371 changes: 371 additions & 0 deletions archive/season_8.sql

Large diffs are not rendered by default.

15 changes: 15 additions & 0 deletions assets/benchmark/TANK_S9_P2_AMERICAS/key.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"answers": [
["Junker Queen", "Sigma", "Wrecking Ball"],
["Junker Queen", "Wrecking Ball", "Sigma"],
["Orisa", "Junker Queen", "Sigma"],
["Winston", "Sigma", "D.Va"],
["Doomfist", "Blank", "Blank"],
["Mauga", "Junker Queen", "Blank"],
["Sigma", "D.Va", "Junker Queen"],
["D.Va", "Junker Queen", "Sigma"],
["Junker Queen", "D.Va", "Sigma"],
["Junker Queen", "Doomfist", "Sigma"]

]
}
4 changes: 3 additions & 1 deletion utils/collector.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
from rich import print

def click_focus():
pg.moveTo(122, 418)
time.sleep(0.2)
pg.click(122, 418)

def click_next_page():
Expand Down Expand Up @@ -65,7 +67,7 @@ def collect_screens(role, region):
for i in range(50):
print(f"Role: {role} Region: {region} Page: {i + 1} ", end="\r")
click_focus()
pg.screenshot().save(f"./tmp/{role}-{region}-{i + 1}.png")
pg.screenshot().save(f"./assets/leaderboard_images/{role}-{region}-{i + 1}.png")
time.sleep(1.5)
click_next_page()

Expand Down
45 changes: 14 additions & 31 deletions utils/generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,16 @@

sys.path.append(".")
import os
from concurrent.futures import ThreadPoolExecutor, as_completed

import dotenv
from PIL import Image
from rich.console import Console
from rich.progress import Progress, track
from rich.prompt import Prompt

import database
import leaderboards
from utils.raise_for_missing_env import raise_for_missing_env_vars
from PIL import Image

dotenv.load_dotenv()

console = Console()
dba = database.DatabaseAccess(
host=os.getenv("MYSQLHOST") or raise_for_missing_env_vars(),
user=os.getenv("MYSQLUSER") or raise_for_missing_env_vars(),
Expand All @@ -31,44 +26,32 @@ def worker(file: str):
role = leaderboards.Role.by_name(role)
region = leaderboards.Region.by_name(region)

results = leaderboards.parse( # parse the leaderboard
image_path=os.path.join("./assets/leaderboard_images", file),
assets_path="./assets/hero_images",
role=role,
region=region,
model_name=model_name,
)
results = leaderboards.parse_leaderboard_to_leaderboard_entries(
leaderboard_image=Image.open(f"./assets/leaderboard_images/{file}"),
region=region, # type: ignore
role=role, # type: ignore
model_name="thearyadev-initial-15-02-2024",
)


for i in results:
if i.heroes[0].name != "Blank":
if i.heroes[0] != "Blank":
dba.add_leaderboard_entry(seasonNumber=target_season, leaderboard_entry=i)


def main():
global target_season, model_name # globals so the worker threads can access them
# sorry

target_season = "8_8"
model_name = "thearyadev-2023-12-20"
target_season = "9"
dba.create_season(seasonNumber=target_season)

files = os.listdir("./assets/leaderboard_images")
max_workers = 1
progress = Progress()

with progress:
progress_bar = progress.add_task(
"[red]Parsing Leaderboard Images...", total=len(files)
)
for file in files:
worker(file)

# with ThreadPoolExecutor(max_workers=max_workers) as executor:
# futures = [executor.submit(worker, file) for file in files]
# for future in as_completed(futures):
# progress.advance(progress_bar)
for file in files:
worker(file)


if __name__ == "__main__":
dba.add_info_entry("season_8_8", None, None )
main()
dba.add_info_entry("season_9", "This season is a test of the new top 500 hero classifier model. There may be issues with this page. This dataset was recorded on Febuary 29, 2AM EDT.", None )
# main()

0 comments on commit f8abc92

Please sign in to comment.