【发布时间】:2017-07-12 19:01:18
【问题描述】:
我收到了来自 AWS 机器学习的回复(我只是展示了一些回复):
{u'Prediction': {u'predictedLabel': u'Luxemburgo', u'predictedScores': {u'Irlanda': 0.0003484287590254098, u'B\xe9lgica': 0.013423046097159386, u'Espa\xf1a': 0.002083213534206152, u'Grecia': 0.0014155727112665772, u'San Marino': 0.00233459216542542, u'Letonia': 0.0008684576023370028, u'Azerbaiy\xe1n': 0.0651199221611023, u'Finlandia': 0.0015709727304056287, u'Andorra': 0.00023321053595282137, u'Italia': 0.0007921983487904072, u'Vaticano': 0.011585880070924759, u'M\xf3naco': 0.01911487616598606, u'Dinamarca': 0.004232937004417181, u'Pa\xedses Bajos': 0.0007871986017562449, u'Islandia': 0.006683974526822567, u'Francia': 0.004822706338018179, u'Montenegro': 0.018228678032755852, u'Bielorrusia': 0.0024703771341592073, u'Alemania': ...
我想在 django 模板中向用户展示预测分数,所以我正在这样做
{% for p in response.Prediction.predictedScores %}
{{p}}
{% endfor %}
这给了我一个很好的国家列表,但我也想显示概率,我不知道如何访问它们。我确信它很简单,但我看不到它。
【问题讨论】:
标签: python json django amazon-web-services django-templates