fix: 修复数据目录迁移导致的目录错误问题
This commit is contained in:
parent
e40e2678ad
commit
f628c10db0
|
@ -37,7 +37,7 @@ def query_anno():
|
||||||
project_name = request.args.get("projectName").strip()
|
project_name = request.args.get("projectName").strip()
|
||||||
file_name = request.args.get("fileName").strip()
|
file_name = request.args.get("fileName").strip()
|
||||||
|
|
||||||
file_path = PROJECT_PATH.format(project_name) + '/' + file_name
|
file_path = PROJECT_PATH.format(project_name) + '/data/' + file_name
|
||||||
file_content = read_file(file_path)
|
file_content = read_file(file_path)
|
||||||
|
|
||||||
anno_output_path = ANNO_OUTPUT_PATH.format(project_name, file_name)
|
anno_output_path = ANNO_OUTPUT_PATH.format(project_name, file_name)
|
||||||
|
|
|
@ -26,7 +26,9 @@ def query_file():
|
||||||
project_path = PROJECT_PATH.format(project_name)
|
project_path = PROJECT_PATH.format(project_name)
|
||||||
if not os.path.exists(project_path):
|
if not os.path.exists(project_path):
|
||||||
os.makedirs(project_path)
|
os.makedirs(project_path)
|
||||||
file_names = os.listdir(project_path)
|
os.makedirs(project_path + '/data')
|
||||||
|
os.makedirs(project_path + '/anno')
|
||||||
|
file_names = os.listdir(project_path + '/data')
|
||||||
if 'config.json' in file_names:
|
if 'config.json' in file_names:
|
||||||
file_names.remove('config.json')
|
file_names.remove('config.json')
|
||||||
if 'anno.json' in file_names:
|
if 'anno.json' in file_names:
|
||||||
|
@ -85,7 +87,6 @@ def get_lables():
|
||||||
return json.dumps(download_json, default=lambda o: o.__dict__)
|
return json.dumps(download_json, default=lambda o: o.__dict__)
|
||||||
|
|
||||||
@api.route('/get_anno_json', methods=['GET'])
|
@api.route('/get_anno_json', methods=['GET'])
|
||||||
@api.route('/get_json', methods=['GET'])
|
|
||||||
def get_anno_json():
|
def get_anno_json():
|
||||||
project_name = request.args.get("projectName")
|
project_name = request.args.get("projectName")
|
||||||
anno_output_dir = ANNO_OUTPUT_PATH.format(project_name, '').replace('.json', '')
|
anno_output_dir = ANNO_OUTPUT_PATH.format(project_name, '').replace('.json', '')
|
||||||
|
|
|
@ -39,7 +39,7 @@ def get_zipped_data():
|
||||||
|
|
||||||
upload_file = request.files['file']
|
upload_file = request.files['file']
|
||||||
file_path = os.path.join(PROJECT_PATH.format(project_name), upload_file.filename)
|
file_path = os.path.join(PROJECT_PATH.format(project_name), upload_file.filename)
|
||||||
target_path = PROJECT_PATH.format(project_name)
|
target_path = PROJECT_PATH.format(project_name) + '/data'
|
||||||
upload_file.save(file_path)
|
upload_file.save(file_path)
|
||||||
file_type = file_path.split('.')[-1]
|
file_type = file_path.split('.')[-1]
|
||||||
# print("zipped data received: .{} form".format(file_type))
|
# print("zipped data received: .{} form".format(file_type))
|
||||||
|
|
|
@ -13,7 +13,7 @@ FILE_NAME = 'fileName'
|
||||||
PROJECTS = 'app/projects'
|
PROJECTS = 'app/projects'
|
||||||
|
|
||||||
# 项目路径
|
# 项目路径
|
||||||
PROJECT_PATH = PROJECTS + '/{}/data/'
|
PROJECT_PATH = PROJECTS + '/{}/'
|
||||||
PROJECT_CONFIG_PATH = PROJECTS + '/' + "{}" + '/config.json'
|
PROJECT_CONFIG_PATH = PROJECTS + '/' + "{}" + '/config.json'
|
||||||
|
|
||||||
#下载标注结果所在的位置
|
#下载标注结果所在的位置
|
||||||
|
|
|
@ -20,7 +20,7 @@ def make_dir(path):
|
||||||
folder = os.path.exists(path)
|
folder = os.path.exists(path)
|
||||||
|
|
||||||
if not folder:
|
if not folder:
|
||||||
os.mkdir(path)
|
os.makedirs(path)
|
||||||
|
|
||||||
# 将json数据写入.json文件
|
# 将json数据写入.json文件
|
||||||
def write_json(json_file_path, data):
|
def write_json(json_file_path, data):
|
||||||
|
@ -58,10 +58,8 @@ def read_txt_file(file_path):
|
||||||
|
|
||||||
def get_project_file(project_path):
|
def get_project_file(project_path):
|
||||||
|
|
||||||
file_name = os.listdir(project_path)
|
file_names = os.listdir(project_path + '/data')
|
||||||
file_name.remove('anno.json')
|
return file_names
|
||||||
file_name.remove('config.json')
|
|
||||||
return file_name
|
|
||||||
|
|
||||||
|
|
||||||
def unzip_file(zip_src, dst_dir):
|
def unzip_file(zip_src, dst_dir):
|
||||||
|
|
Loading…
Reference in New Issue