def get_results(): testname = request.args.get('testname', None) configname = request.args.get('configname', None) trainname = request.args.get('trainname', None) modelname = request.args.get('modelname', None) dict_eval = read_list('static/eval/eval_list') key = (testname, trainname, configname, modelname) res_file = dict_eval[key] return redirect(url_for('show_content', filename=res_file, file_dir='', type='eval'))
def download_results(): print('begin to download') testname = request.args.get('testname', None) configname = request.args.get('configname', None) trainname = request.args.get('trainname', None) modelname = request.args.get('modelname', None) dict_eval = read_list('static/eval/eval_list') key = (testname, trainname, configname, modelname) res_file = dict_eval[key] print('download', res_file) out_file = os.path.join(os.getcwd(), eval_root, res_file + '.tar.gz') return send_file(out_file, attachment_filename=res_file + 'tar.gz', as_attachment=True)
def add_eval_report(file_test, file_train, file_config, file_model): eval_file = pjoin(eval_root, 'eval_list') dict_eval = read_list(eval_file) key = (file_test, file_train, file_config, file_model) uni_model_dir = uuid.uuid4().hex if key in dict_eval: old_eval_file = dict_eval[key] report_file = pjoin(eval_root, old_eval_file) if os.path.exists(report_file): os.remove(report_file) if os.path.exists(report_file + '.tar.gz'): os.remove(report_file + '.tar.gz') dict_eval[key] = uni_model_dir write_list(eval_file, dict_eval) return dict_eval[key]
def delete_results(): testname = request.args.get('testname', None) configname = request.args.get('configname', None) trainname = request.args.get('trainname', None) modelname = request.args.get('modelname', None) dict_eval = read_list('static/eval/eval_list') key = (testname, trainname, configname, modelname) if key in dict_eval: res_file = dict_eval[key] report_file = os.path.join(eval_root, res_file) print('delete_results', report_file) if os.path.exists(report_file): os.remove(report_file) out_file = report_file + '.tar.gz' if os.path.exists(out_file): os.remove(out_file) update_list('static/eval/eval_list', res_file) return redirect(url_for('manage_eval'))
def get_eval_report(): dict_res = read_list('static/eval/eval_list') return dict_res