如何在html中直接显示对象,如何在python中解析jsonify对象并在html中显示?

我有一个flask应用程序,它返回jsonify函数的输出,但是在html上显示的输出并不漂亮。我现在分析这个输出并在返回到html之前修改它。我试图迭代json输出,但它不允许我这样做。我该怎么做?在

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

healthy,0.2868120325729251,Blueberry healthy,0.05757397739216685

我想要这样的东西Predictions:

Apple Cedar rust: 99.6459424495697

Bell_Pepper healthy: 0.2868120325729251

Blueberry healthy: 0.05757397739216685

下面是我的应用程序副本文件@app.route('/predict', methods=['GET', 'POST'])

def upload():

if request.method == 'POST':

# Get the file from post request

f = request.files['file']

# Save the file to ./uploads

basepath = os.path.dirname(__file__)

file_path = os.path.join(

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

f.save(file_path)

result = model_predict(file_path, model)

return jsonify(result)

return None

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

^{pr2}$

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值