Beispiel #1
0
 def upload_play_data(self, path, filename):
     digest = CChessModel.fetch_digest(self.config.resource.model_best_weight_path)
     data = {'digest': digest, 'username': self.config.internet.username, 'version': '2.4'}
     response = upload_file(self.config.internet.upload_url, path, filename, data, rm=False)
     if response is not None and response['status'] == 0:
         logger.info(f"上传博弈数据 {filename} 成功.")
     else:
         logger.error(f'上传博弈数据 {filename} 失败. {response.msg if response is not None else None}')
 def upload_play_data(self, path, filename):
     digest = CChessModel.fetch_digest(self.config.resource.model_best_weight_path)
     data = {'digest': digest, 'username': self.config.internet.username}
     response = upload_file(self.config.internet.upload_url, path, filename, data, rm=False)
     if response is not None and response['status'] == 0:
         logger.info(f"Upload play data {filename} finished.")
     else:
         logger.error(f'Upload play data {filename} failed. {response.msg if response is not None else None}')
Beispiel #3
0
def test_upload():
    from cchess_alphazero.lib.web_helper import upload_file
    from cchess_alphazero.config import Config
    c = Config('mini')
    url = 'http://alphazero.52coding.com.cn/api/upload_game_file'
    path = '/Users/liuhe/Documents/Graduation Project/ChineseChess-AlphaZero/data/play_data/test.json'
    filename = 'test.json'
    data = {'digest': 'test', 'username': '******'}
    res = upload_file(url, path, filename=filename, data=data)
    print(res)
Beispiel #4
0
 def upload_play_data(self, path, filename):
     digest = CChessModel.fetch_digest(
         self.config.resource.model_best_weight_path)
     data = {'digest': digest, 'username': self.config.internet.username}
     response = upload_file(self.config.internet.upload_url,
                            path,
                            filename,
                            data,
                            rm=False)
     if response is not None and response['status'] == 0:
         logger.info(f"Upload play data {filename} finished.")
     else:
         logger.error(
             f'Upload play data {filename} failed. {response.msg if response is not None else None}'
         )
Beispiel #5
0
 def upload_eval_data(self, path, filename, red, black, result, score):
     hash = self.fetch_digest(path)
     data = {
         'digest': self.data['unchecked']['digest'],
         'red_digest': red,
         'black_digest': black,
         'result': result,
         'score': score,
         'hash': hash
     }
     response = upload_file(self.config.internet.upload_eval_url,
                            path,
                            filename,
                            data,
                            rm=False)
     return response