diff --git a/mjai/bot/bot.py b/mjai/bot/bot.py index 92f1d1a..21adfc3 100644 --- a/mjai/bot/bot.py +++ b/mjai/bot/bot.py @@ -17,7 +17,7 @@ def __init__(self, player_id: int): with open(model_path, "rb") as f: self.model_hash = hashlib.sha256(f.read()).hexdigest() try: - with open(pathlib.Path(__file__).parent / "online.json", "r") as f: + with open(pathlib.Path(__file__).parent.parent / "online.json", "r") as f: online_json = json.load(f) self.online = online_json["online"] if not self.online: diff --git a/mjai/bot/model.py b/mjai/bot/model.py index 80a51b2..99a9388 100644 --- a/mjai/bot/model.py +++ b/mjai/bot/model.py @@ -1,4 +1,6 @@ import json +import gzip +import requests import numpy as np import torch import pathlib @@ -10,8 +12,6 @@ from functools import partial from itertools import permutations import riichi -import gzip -import requests class ChannelAttention(nn.Module): def __init__(self, channels, ratio=16, actv_builder=nn.ReLU, bias=True): @@ -386,7 +386,7 @@ def get_engine() -> MortalEngine: mortal.load_state_dict(state['mortal']) dqn.load_state_dict(state['current_dqn']) - with open(pathlib.Path(__file__).parent / 'online.json', 'r') as f: + with open(pathlib.Path(__file__).parent.parent / 'online.json', 'r') as f: json_load = json.load(f) server = json_load['server'] online = json_load['online'] diff --git a/mjai/bot/online.json b/mjai/bot/online.json deleted file mode 100644 index f8e35dd..0000000 --- a/mjai/bot/online.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "server": "http://34.71.176.237:5000", - "online": false, - "api_key": "your_api_key_here" -} \ No newline at end of file diff --git a/mjai/online.json b/mjai/online.json new file mode 100644 index 0000000..1b52b38 --- /dev/null +++ b/mjai/online.json @@ -0,0 +1,5 @@ +{ + "server": "http://127.0.0.1:5000", + "online": false, + "api_key": "api_key" +} \ No newline at end of file