Jimin Park
commited on
Commit
·
36cc9c0
1
Parent(s):
3224c57
added model
Browse files- util/Recent_match_scrapper.py +2 -0
- util/__pycache__/Leaderboard_scrapper.cpython-311.pyc +0 -0
- util/__pycache__/Meta_scrapper.cpython-311.pyc +0 -0
- util/__pycache__/Player_scrapper.cpython-311.pyc +0 -0
- util/__pycache__/Recent_match_scrapper.cpython-311.pyc +0 -0
- util/__pycache__/Weekly_meta_scrapper.cpython-311.pyc +0 -0
- util/__pycache__/app_training_df_getter.cpython-311.pyc +0 -0
- util/__pycache__/connection_check.cpython-311.pyc +0 -0
- util/__pycache__/feature_eng.cpython-311.pyc +0 -0
- util/__pycache__/helper.cpython-311.pyc +0 -0
- util/app.py +5 -19
- util/app_training_df_getter.py +7 -16
util/Recent_match_scrapper.py
CHANGED
@@ -219,6 +219,8 @@ def process_match_data(match_data, username, players):
|
|
219 |
return None
|
220 |
|
221 |
def get_matches_stats(region, username, max_retries=2):
|
|
|
|
|
222 |
"""
|
223 |
Get match stats for a single player with retry mechanism
|
224 |
"""
|
|
|
219 |
return None
|
220 |
|
221 |
def get_matches_stats(region, username, max_retries=2):
|
222 |
+
print("====================== Inside get_matches_stats======================= \n")
|
223 |
+
print("input parameters, region: ", region, " username: ", username)
|
224 |
"""
|
225 |
Get match stats for a single player with retry mechanism
|
226 |
"""
|
util/__pycache__/Leaderboard_scrapper.cpython-311.pyc
ADDED
Binary file (8.41 kB). View file
|
|
util/__pycache__/Meta_scrapper.cpython-311.pyc
ADDED
Binary file (8.55 kB). View file
|
|
util/__pycache__/Player_scrapper.cpython-311.pyc
ADDED
Binary file (29.2 kB). View file
|
|
util/__pycache__/Recent_match_scrapper.cpython-311.pyc
ADDED
Binary file (21.4 kB). View file
|
|
util/__pycache__/Weekly_meta_scrapper.cpython-311.pyc
ADDED
Binary file (5.15 kB). View file
|
|
util/__pycache__/app_training_df_getter.cpython-311.pyc
ADDED
Binary file (20.1 kB). View file
|
|
util/__pycache__/connection_check.cpython-311.pyc
ADDED
Binary file (1.6 kB). View file
|
|
util/__pycache__/feature_eng.cpython-311.pyc
ADDED
Binary file (16.8 kB). View file
|
|
util/__pycache__/helper.cpython-311.pyc
ADDED
Binary file (53.7 kB). View file
|
|
util/app.py
CHANGED
@@ -4,18 +4,7 @@ import pandas as pd
|
|
4 |
import requests
|
5 |
import xgboost as xgb
|
6 |
from huggingface_hub import hf_hub_download
|
7 |
-
|
8 |
-
from Recent_match_scrapper import get_multiple_matches_stats
|
9 |
-
from Meta_scrapper import get_meta_stats
|
10 |
-
from Leaderboard_scrapper import scrape_leaderboards
|
11 |
-
from connection_check import check_connection
|
12 |
-
from helper import merge_stats, filter_leaderboard, get_player_list
|
13 |
-
from Player_scrapper import get_multiple_player_stats, get_player_stats
|
14 |
-
from feature_eng import create_champion_features
|
15 |
-
from Weekly_meta_scrapper import get_weekly_meta
|
16 |
from app_training_df_getter import create_app_user_training_df
|
17 |
-
from sklearn.metrics import top_k_accuracy_score
|
18 |
-
|
19 |
import os
|
20 |
import time
|
21 |
from selenium import webdriver
|
@@ -25,7 +14,6 @@ from webdriver_manager.chrome import ChromeDriverManager
|
|
25 |
from selenium.webdriver.common.by import By
|
26 |
from selenium.webdriver.support.ui import WebDriverWait
|
27 |
from selenium.webdriver.support import expected_conditions as EC
|
28 |
-
from helper import format_summoner_name
|
29 |
|
30 |
# Define champion list for dropdowns
|
31 |
CHAMPIONS = [
|
@@ -63,16 +51,12 @@ except Exception as e:
|
|
63 |
# Functions
|
64 |
def get_user_training_df(player_opgg_url):
|
65 |
try:
|
|
|
|
|
66 |
|
67 |
# Add input validation
|
68 |
if not player_opgg_url or not isinstance(player_opgg_url, str):
|
69 |
return "Invalid URL provided"
|
70 |
-
|
71 |
-
print("type(player_opgg_url) : ", type(player_opgg_url))
|
72 |
-
print("player_opgg_url = ", player_opgg_url)
|
73 |
-
|
74 |
-
# Add debugging print
|
75 |
-
print(f"Processing URL: {player_opgg_url}")
|
76 |
|
77 |
training_df = create_app_user_training_df(player_opgg_url)
|
78 |
return training_df
|
@@ -122,6 +106,7 @@ def show_stats(player_opgg_url):
|
|
122 |
|
123 |
def predict_champion(player_opgg_url, *champions):
|
124 |
"""Make prediction based on selected champions"""
|
|
|
125 |
if not player_opgg_url or None in champions:
|
126 |
return "Please fill in all fields"
|
127 |
|
@@ -175,7 +160,8 @@ with gr.Blocks() as demo:
|
|
175 |
)
|
176 |
|
177 |
# Enable queuing
|
178 |
-
demo.queue()
|
|
|
179 |
|
180 |
# For local testing
|
181 |
if __name__ == "__main__":
|
|
|
4 |
import requests
|
5 |
import xgboost as xgb
|
6 |
from huggingface_hub import hf_hub_download
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
from app_training_df_getter import create_app_user_training_df
|
|
|
|
|
8 |
import os
|
9 |
import time
|
10 |
from selenium import webdriver
|
|
|
14 |
from selenium.webdriver.common.by import By
|
15 |
from selenium.webdriver.support.ui import WebDriverWait
|
16 |
from selenium.webdriver.support import expected_conditions as EC
|
|
|
17 |
|
18 |
# Define champion list for dropdowns
|
19 |
CHAMPIONS = [
|
|
|
51 |
# Functions
|
52 |
def get_user_training_df(player_opgg_url):
|
53 |
try:
|
54 |
+
print("========= Inside get_user_training_df(player_opgg_url) ============= \n")
|
55 |
+
print("player_opgg_url: ", player_opgg_url, "\n")
|
56 |
|
57 |
# Add input validation
|
58 |
if not player_opgg_url or not isinstance(player_opgg_url, str):
|
59 |
return "Invalid URL provided"
|
|
|
|
|
|
|
|
|
|
|
|
|
60 |
|
61 |
training_df = create_app_user_training_df(player_opgg_url)
|
62 |
return training_df
|
|
|
106 |
|
107 |
def predict_champion(player_opgg_url, *champions):
|
108 |
"""Make prediction based on selected champions"""
|
109 |
+
|
110 |
if not player_opgg_url or None in champions:
|
111 |
return "Please fill in all fields"
|
112 |
|
|
|
160 |
)
|
161 |
|
162 |
# Enable queuing
|
163 |
+
demo.queue(debug = True)
|
164 |
+
#demo.launch(share=True)
|
165 |
|
166 |
# For local testing
|
167 |
if __name__ == "__main__":
|
util/app_training_df_getter.py
CHANGED
@@ -1,26 +1,14 @@
|
|
1 |
-
from Recent_match_scrapper import
|
2 |
import os
|
3 |
import pandas as pd
|
4 |
import numpy as np
|
5 |
from Meta_scrapper import *
|
6 |
-
from
|
7 |
-
from
|
8 |
-
from helper import merge_stats, filter_leaderboard, get_player_list, process_kda_perfect, ChampionConverter
|
9 |
-
from Player_scrapper import get_multiple_player_stats, get_player_stats
|
10 |
-
from feature_eng import create_champion_features
|
11 |
from Weekly_meta_scrapper import *
|
12 |
import pandas as pd
|
13 |
import re
|
14 |
|
15 |
-
from selenium import webdriver
|
16 |
-
from selenium.webdriver.chrome.service import Service
|
17 |
-
from selenium.webdriver.chrome.options import Options
|
18 |
-
from webdriver_manager.chrome import ChromeDriverManager
|
19 |
-
from selenium.webdriver.common.by import By
|
20 |
-
from selenium.webdriver.support.ui import WebDriverWait
|
21 |
-
from selenium.webdriver.support import expected_conditions as EC
|
22 |
-
from helper import convert_percentage_to_decimal
|
23 |
-
|
24 |
# ============================================ my functions =========================================================
|
25 |
|
26 |
|
@@ -450,8 +438,10 @@ def create_app_user_training_df(url):
|
|
450 |
|
451 |
#weekly_meta_stats = get_weekly_meta()
|
452 |
|
|
|
|
|
|
|
453 |
# Input validation
|
454 |
-
print("Input URL is: ", url, "\n")
|
455 |
if not url or not isinstance(url, str):
|
456 |
raise ValueError("Invalid URL provided")
|
457 |
|
@@ -533,3 +523,4 @@ def create_app_user_training_df(url):
|
|
533 |
#url = "https://www.op.gg/summoners/euw/Agurin-EUW"
|
534 |
#return_value = create_app_user_training_df(url)
|
535 |
#print("type(Return_value):", type(return_value), "\n return value: \n", return_value)
|
|
|
|
1 |
+
from Recent_match_scrapper import get_matches_stats
|
2 |
import os
|
3 |
import pandas as pd
|
4 |
import numpy as np
|
5 |
from Meta_scrapper import *
|
6 |
+
from helper import merge_stats, process_kda_perfect, ChampionConverter
|
7 |
+
from Player_scrapper import get_player_stats
|
|
|
|
|
|
|
8 |
from Weekly_meta_scrapper import *
|
9 |
import pandas as pd
|
10 |
import re
|
11 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
# ============================================ my functions =========================================================
|
13 |
|
14 |
|
|
|
438 |
|
439 |
#weekly_meta_stats = get_weekly_meta()
|
440 |
|
441 |
+
print("========= Inside get_user_training_df(player_opgg_url) ============= \n")
|
442 |
+
print("input url: ", url, "\n")
|
443 |
+
|
444 |
# Input validation
|
|
|
445 |
if not url or not isinstance(url, str):
|
446 |
raise ValueError("Invalid URL provided")
|
447 |
|
|
|
523 |
#url = "https://www.op.gg/summoners/euw/Agurin-EUW"
|
524 |
#return_value = create_app_user_training_df(url)
|
525 |
#print("type(Return_value):", type(return_value), "\n return value: \n", return_value)
|
526 |
+
|