mirror of https://github.com/hykilpikonna/AquaDX
[+] Log recommendations
parent
767d396171
commit
f6a5a03346
|
@ -209,13 +209,15 @@ abstract class GameApiController<T : IUserData>(val name: String, userDataClass:
|
|||
SELECT user_id, music_id, count(*) as count
|
||||
FROM ${tableName}_user_playlog_view
|
||||
GROUP BY user_id, music_id;
|
||||
""".trimIndent()).exec.numCsv("user_id", "music_id", "count")
|
||||
""".trimIndent()).exec.also {
|
||||
logger.info("Recommender fetched ${it.size} plays")
|
||||
}.numCsv("user_id", "music_id", "count")
|
||||
}
|
||||
|
||||
@API("recommender-update")
|
||||
fun recommenderUpdate(@RP botSecret: String, @RB data: Map<Long, List<Int>>) {
|
||||
if (botSecret != botProps.secret) 403 - "Invalid Secret"
|
||||
|
||||
recommendedMusic = data
|
||||
logger.info("Recommender updated with ${data.size} users")
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
This is a music recommendation system for maimai2 using implicit ALS.
|
||||
"""
|
||||
import json
|
||||
from io import StringIO
|
||||
from pathlib import Path
|
||||
|
||||
import pandas as pd
|
||||
|
@ -12,7 +13,7 @@ from hypy_utils.logging_utils import setup_logger
|
|||
|
||||
BASE_URL = "https://aquadx.net/aqua/api/v2/game"
|
||||
GAME = "mai2"
|
||||
BOT_SECRET = "meow"
|
||||
BOT_SECRET = "hunter2"
|
||||
|
||||
log = setup_logger()
|
||||
|
||||
|
@ -23,7 +24,7 @@ if __name__ == '__main__':
|
|||
# data = pd.read_csv("data.csv")
|
||||
resp = requests.get(f"{BASE_URL}/{GAME}/recommender-fetch", params={"botSecret": BOT_SECRET})
|
||||
assert resp.status_code == 200, f"Failed to fetch data: {resp.status_code} {resp.text}"
|
||||
data = pd.read_csv(resp.text)
|
||||
data = pd.read_csv(StringIO(resp.text))
|
||||
|
||||
# Create a user-item matrix
|
||||
log.info("Creating user-item matrix...")
|
||||
|
|
Loading…
Reference in New Issue