This commit is contained in:
lichen
2022-04-12 16:52:54 +08:00
parent 25abdaf64f
commit cbcdb2bf8a

View File

@ -27,12 +27,12 @@ import logging
app = Flask(__name__)
# 日志系统配置
handler = logging.FileHandler('app.log', encoding='UTF-8')
handler.setLevel(logging.DEBUG)
logging_format = logging.Formatter(
'%(asctime)s - %(levelname)s - %(filename)s - %(funcName)s - %(lineno)s - %(message)s')
handler.setFormatter(logging_format)
app.logger.addHandler(handler)
#handler = logging.FileHandler('app.log', encoding='UTF-8')
#handler.setLevel(logging.DEBUG)
#logging_format = logging.Formatter(
# '%(asctime)s - %(levelname)s - %(filename)s - %(funcName)s - %(lineno)s - %(message)s')
#handler.setFormatter(logging_format)
#app.logger.addHandler(handler)
'''
load model
'''
@ -70,7 +70,7 @@ def loadModel():
return all_model
def CheckRange(code):
with open('goodsCategory.json', 'r', encoding='utf-8') as jsonPath:
with open('../module/ieemoo-ai-predict/data/goodsCategory.json', 'r', encoding='utf-8') as jsonPath:
loadDict = json.load(jsonPath)
for key in loadDict:
if code in loadDict[key]:
@ -178,7 +178,7 @@ def predict():
if request.method == 'POST':
try:
data = request.get_data()
print(type(data))
print(data)
data_str = data.decode("utf-8")
json_data = json.loads(data_str)
pic = json_data.get("file")