diff --git a/be/app/api/v1/anno.py b/be/app/api/v1/anno.py
index 86e235b..76511ce 100644
--- a/be/app/api/v1/anno.py
+++ b/be/app/api/v1/anno.py
@@ -7,7 +7,7 @@ import json
import os
import zipfile
-from ...libs.tools import read_txt_file, write_json, read_json_file, make_dir
+from ...libs.tools import read_file, write_json, read_json_file, make_dir
api = RedPrint('anno')
@@ -59,7 +59,7 @@ def query_anno():
file_name = request.args.get("fileName").strip()
file_path = PROJECTS + '/' + project_name + '/' + file_name
- file_content = read_txt_file(file_path)
+ file_content = read_file(file_path)
anno_output_path = ANNO_OUTPUT_PATH.format(project_name)
output_anno = OutputAnno()
diff --git a/be/app/api/v1/project.py b/be/app/api/v1/project.py
index 86f91de..b84f6b7 100644
--- a/be/app/api/v1/project.py
+++ b/be/app/api/v1/project.py
@@ -53,7 +53,7 @@ def get_zipped_data():
folder_path = target_path + '/' + item
if os.path.isdir(folder_path):
for file in os.listdir(folder_path):
- if file.split('.')[-1] == 'txt':
+ if file.split('.')[-1] in ['txt', 'jpg', 'png']:
shutil.copy(folder_path + '/' + file, folder_path + '/../')
# Here to deal with chinese encode in module zipfile and rarfile
if file_type == 'zip':
diff --git a/be/app/libs/tools.py b/be/app/libs/tools.py
index aec60b9..b450f0d 100644
--- a/be/app/libs/tools.py
+++ b/be/app/libs/tools.py
@@ -8,6 +8,7 @@ import tarfile
from os import rename
from os import listdir
from shutil import move
+import base64
def make_dir(path):
@@ -29,6 +30,20 @@ def read_json_file(json_file_name):
data = json.load(f)
return data
+# 自适配读取文件
+def read_file(file_path):
+ ext = file_path.split('.')[-1]
+ if ext in ['jpg', 'png']:
+ return read_img_file(file_path)
+ elif ext in ['txt']:
+ return read_txt_file(file_path)
+ return ''
+
+# 读取img文件
+def read_img_file(file_path):
+ with open(file_path, 'rb') as f:
+ data = f.read()
+ return base64.b64encode(data).decode("ascii")
# 读取txt文件
def read_txt_file(file_path):
diff --git a/fe/config/index.js b/fe/config/index.js
index 94ad609..ba981cb 100644
--- a/fe/config/index.js
+++ b/fe/config/index.js
@@ -12,8 +12,8 @@ module.exports = {
assetsPublicPath: '/',
proxyTable: {
'/v1/': {
- // target: 'http://localhost:9060/',
- target: 'https://tekii.cn/',
+ target: 'http://localhost:9060/',
+ // target: 'https://tekii.cn/',
}
},
diff --git a/fe/src/components/NER/index.vue b/fe/src/components/NER/index.vue
index 84cc68c..fe40ae9 100644
--- a/fe/src/components/NER/index.vue
+++ b/fe/src/components/NER/index.vue
@@ -106,6 +106,9 @@
+