File size: 3,677 Bytes
6bf9e00
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
366dac3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6bf9e00
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
52cb39a
6bf9e00
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
{% extends "base.html" %}

{% block title %}History Dashboard | Traffic Sign Classifier{% endblock %}

{% block content %}
<section class="dashboard-head">
  <div>
    <p class="eyebrow">Historique</p>
    <h1>Prediction dashboard</h1>
    <p class="panel-copy">Review predictions, mark them true or false, and track feedback quality.</p>
  </div>
  <a class="button primary" href="{{ url_for('predict') }}">New prediction</a>
</section>

<section class="stats-grid">
  <article><span>Total</span><strong>{{ stats.total }}</strong></article>
  <article><span>Reviewed</span><strong>{{ stats.reviewed }}</strong></article>
  <article><span>True</span><strong>{{ stats.correct }}</strong></article>
  <article><span>False</span><strong>{{ stats.incorrect }}</strong></article>
  <article><span>Feedback accuracy</span><strong>{{ stats.accuracy }}%</strong></article>
</section>

<section class="charts-grid">
  <article class="chart-panel">
    <div class="chart-heading">
      <h2>Predictions by class</h2>
      <span>Top {{ charts.class_chart|length }}</span>
    </div>
    <div class="bar-list">
      {% for item in charts.class_chart %}
        <div class="bar-row">
          <div class="bar-meta">
            <span>{{ item.label }}</span>
            <strong>{{ item.count }}</strong>
          </div>
          <div class="bar-track">
            <span class="bar-fill class-fill" style="width: {{ item.percent }}%"></span>
          </div>
        </div>
      {% else %}
        <p class="empty">No class data yet.</p>
      {% endfor %}
    </div>
  </article>

  <article class="chart-panel">
    <div class="chart-heading">
      <h2>Feedback summary</h2>
      <span>{{ stats.reviewed }} reviewed</span>
    </div>
    <div class="bar-list">
      {% for item in charts.feedback_chart %}
        <div class="bar-row">
          <div class="bar-meta">
            <span>{{ item.label }}</span>
            <strong>{{ item.count }}</strong>
          </div>
          <div class="bar-track">
            <span class="bar-fill feedback-fill fill-{{ loop.index }}" style="width: {{ item.percent }}%"></span>
          </div>
        </div>
      {% endfor %}
    </div>
  </article>
</section>

<section class="table-panel">
  <table>
    <thead>
      <tr>
        <th>Image</th>
        <th>Prediction</th>
        <th>Confidence</th>
        <th>Feedback</th>
        <th>Action</th>
      </tr>
    </thead>
    <tbody>
      {% for row in history %}
        <tr>
          <td><img class="thumb" src="{{ url_for('static', filename=row.image_path) }}" alt="Traffic sign"></td>
          <td>{{ row.predicted_class }}</td>
          <td>{{ format_confidence(row.confidence) }}</td>
          <td>
            {% if row.is_correct == 1 %}
              <span class="status true">True</span>
            {% elif row.is_correct == 0 %}
              <span class="status false">False</span>
            {% else %}
              <span class="status pending">Pending</span>
            {% endif %}
          </td>
          <td>
            <form class="feedback-row compact" method="post" action="{{ url_for('feedback', prediction_id=row.id) }}">
              <input type="hidden" name="next" value="{{ url_for('dashboard') }}">
              <button name="is_correct" value="1" class="feedback true" type="submit">True</button>
              <button name="is_correct" value="0" class="feedback false" type="submit">False</button>
            </form>
          </td>
        </tr>
      {% else %}
        <tr>
          <td colspan="5" class="empty">No prediction history yet.</td>
        </tr>
      {% endfor %}
    </tbody>
  </table>
</section>
{% endblock %}