feat: 点标注文件下载
This commit is contained in:
parent
fc9d458495
commit
1b2cd2deeb
|
@ -96,6 +96,15 @@ def get_lables():
|
|||
ret_info.errMsg = str(e)
|
||||
return json.dumps(download_json, default=lambda o: o.__dict__)
|
||||
|
||||
@api.route('/get_anno_json', methods=['GET'])
|
||||
def get_anno_json():
|
||||
project_name = request.args.get("projectName")
|
||||
anno_json_path = DOWNLOAD_FILE_LOCATION.format(project_name).replace('result.json', 'anno.json')
|
||||
print(anno_json_path)
|
||||
response = make_response(send_from_directory(directory='', path=anno_json_path, as_attachment=True))
|
||||
response.headers["Content-disposition"] = 'attachment; filename=result.json'
|
||||
|
||||
return response
|
||||
|
||||
@api.route('/get_json', methods=['GET'])
|
||||
def get_json():
|
||||
|
|
|
@ -624,11 +624,12 @@ export default {
|
|||
// 非单机版,就直接通过url下载
|
||||
if (this.projectType === '命名实体识别') {
|
||||
window.open(`/v1/files/get_json?projectName=${this.projectName}`, '_self')
|
||||
}
|
||||
if (this.projectType === '文本分类') {
|
||||
} else if (this.projectType === '文本分类') {
|
||||
get(`/v1/files/get_labels?projectName=${this.projectName}`, (text) => {
|
||||
saveAsFile(JSON.stringify(JSON.parse(text)), 'labels.json')
|
||||
}, {isDirect: true})
|
||||
} else {
|
||||
window.open(`/v1/files/get_anno_json?projectName=${this.projectName}`, '_self')
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue