首页 > 编程知识 正文

python如何解析json,python对象转字典

时间:2023-05-06 15:18:42 阅读:14418 作者:1125

虽然有返回jsonify函数输出的flask APP应用程序,但html中显示的输出不漂亮。 我现在分析这个输出,在返回html之前修改它。 我试图重复json输出,但那是我不允许的。 我该怎么办? 在

首先,我页面上jsonify函数的输出Prediction: Apple Cedar rust,99.6459424495697,Bell_Pepper

healthy,0.2868120325729251,Blueberry healthy,0.05757397739216685

我想要这样的东西Predictions:

applecedarrust :99.6459424495697

bell _ pepper healthy :2868120325729251

蓝牙健康:05757397739216685

以下是我的APP应用程序复制文件@app.route(/predict ),methods=['GET ',' POST']。

efupload(: )

if request.method=='POST':

# Get the file from post request

f=request.files['file']

# Save the file to ./uploads

(basepath=OS.path.dirname (_ _ file _ ) ) ) ) ) ) 65

file_path=os.path.join (

basepath,' uploads ',secure_filename () f.filename ) )

f.save(file_path ) )。

结果=model _ predict (file _ path,model ) )。

返回日期(结果) )。

返回无

最后是我的代码主. js文件

^{pr2}$

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。