提交 2cb079a7 编写于 作者: S shenyuhan

1.modify key'input_img' to key'image'

......@@ -209,9 +209,9 @@ def create_app():
global results_dict
req_id = request.data.get("id")
img_base64 = request.form.get("input_img", "")
img_base64 = request.form.get("image", "")
if img_base64 != "":
img_base64 = request.form.get("input_img", "")
img_base64 = request.form.get("image", "")
ext = img_base64.split(";")[0].split("/")[-1]
if ext not in ["jpeg", "jpg", "png"]:
return {"result": "Unrecognized file type"}
......@@ -221,7 +221,7 @@ def create_app():
with open(filename, "wb") as fp:
fp.write(img_data)
else:
file = request.files["input_img"]
file = request.files["image"]
filename = file.filename
ext = file.filename.split(".")[-1]
if ext not in ["jpeg", "jpg", "png"]:
......@@ -276,7 +276,7 @@ def create_app():
def predict_text(module_name):
global results_dict, queues_dict
req_id = request.data.get("id")
data_list = request.form.get("input_text")
data_list = request.form.get("text")
score = time.time()
data_list = data_list.splitlines()
data_temp = []
......
......@@ -219,7 +219,7 @@ def create_app():
def predict_image(module_name):
req_id = request.data.get("id")
global use_gpu
img_base64 = request.form.getlist("input_img")
img_base64 = request.form.getlist("image")
file_name_list = []
if img_base64 != "":
for item in img_base64:
......@@ -235,7 +235,7 @@ def create_app():
with open(filename, "wb") as fp:
fp.write(img_data)
else:
file = request.files.getlist("input_img")
file = request.files.getlist("image")
for item in file:
file_name = req_id + "_" + item.filename
item.save(file_name)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册