-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathreport.html
38 lines (35 loc) · 928 Bytes
/
report.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
{% if score < 0.5 %}
{% set tcls = 'text-danger' %}
{% elif score < 0.7 %}
{% set tcls = 'text-warning' %}
{% elif score >= 0.7 %}
{% set tcls = 'text-success' %}
{% end %}
<div class="container-fluid">
<div class="row">
<div class="h3 text-center">
Your model scored <span class="{{ tcls }}">{{ '{:.2%}'.format(score) }}</span>
</div>
</div>
<div class="row">
<div id="modelchart"></div>
</div>
</div>
{% if spec %}
<script>
{% import json %}
{% try %}
{% set specs = json.loads(spec) %}
{% autoescape None %}
{% from tornado.escape import json_decode %}
var spec = {{ spec }}
var view = new vega.View(vega.parse(vegaLite.compile(spec).spec))
.renderer('svg')
.initialize('#modelchart')
.hover()
.run()
{% except (json.JSONDecodeError, TypeError) %}
$('#modelchart').html('<img src="chart.png"/>')
{% end %}
</script>
{% end %}