修复评估BUG

This commit is contained in:
zhiyang7 2022-01-05 11:39:35 +08:00
parent 8980a97324
commit 4f8db44ae4
1 changed files with 6 additions and 2 deletions

View File

@ -31,7 +31,7 @@ def upload():
if type not in ['lite_resnet', 'lite_vanilla', 'legacy_vanilla', 'lite_unified']: if type not in ['lite_resnet', 'lite_vanilla', 'legacy_vanilla', 'lite_unified']:
return jsonify({'status': -1, 'message': 'illegal type'}) return jsonify({'status': -1, 'message': 'illegal type'})
position = request.form.get("position") position = request.form.get("position")
if position not in positions: if position != 'uni' and position not in positions:
return jsonify({'status': -2, 'message': 'illegal position'}) return jsonify({'status': -2, 'message': 'illegal position'})
frame = int(request.form.get("frame")) frame = int(request.form.get("frame"))
model_file = request.files.get('model_file') model_file = request.files.get('model_file')
@ -42,6 +42,10 @@ def upload():
if model is None: if model is None:
model_file.save(path) model_file.save(path)
Model.create(path=path, position=position,type=type,frame=frame,create_time=datetime.now()) Model.create(path=path, position=position,type=type,frame=frame,create_time=datetime.now())
if position == 'uni':
for position in positions:
Battle.create(challenger_path=path, challenger_position=position, status=0)
else:
Battle.create(challenger_path=path, challenger_position=position, status=0) Battle.create(challenger_path=path, challenger_position=position, status=0)
return jsonify({'status': 0, 'message': 'success', 'result': ''}) return jsonify({'status': 0, 'message': 'success', 'result': ''})