File size: 2,037 Bytes
c8e1e67
 
 
 
 
 
 
 
549c42b
c8e1e67
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8"/>
  <meta name="viewport" content="width=device-width,initial-scale=1"/>
  <title>{% block title %}Cricket AI Predictor{% endblock %}</title>
  <link rel="preconnect" href="https://fonts.googleapis.com"/>
  <link href="https://fonts.googleapis.com/css2?family=Oswald:wght@400;500;600;700&family=DM+Sans:wght@300;400;500;600&display=swap" rel="stylesheet"/>
 <link rel="stylesheet" href="{{ url_for('static', filename='style.css') }}">
  <script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/4.4.1/chart.umd.js"></script>
</head>
<body>

<!-- NAV -->
<nav class="navbar">
  <div class="nav-inner">
    <div class="nav-brand">
      <div class="cricket-ball"></div>
      <span>Cricket AI Predictor</span>
    </div>
    <div class="nav-links">
      <a href="/" class="nav-link {% if request.path == '/' %}active{% endif %}">Predict</a>
      <a href="/simulate" class="nav-link {% if request.path == '/simulate' %}active{% endif %}">Simulate</a>
      <a href="/model-info" class="nav-link {% if request.path == '/model-info' %}active{% endif %}">Model Info</a>
    </div>
  </div>
</nav>

<!-- CONTENT -->
<main class="main-content">
  {% block content %}{% endblock %}
</main>

<!-- SHARED SCRIPTS -->
<script>
  // ── Shared utility functions available on all pages ──────────
  window.API_BASE = "";   // same-origin Flask server

  async function apiPost(endpoint, body) {
    const res = await fetch(API_BASE + endpoint, {
      method: "POST",
      headers: { "Content-Type": "application/json" },
      body: JSON.stringify(body),
    });
    const data = await res.json();
    if (!res.ok) throw new Error(data.error || "Server error");
    return data;
  }

  async function apiGet(endpoint) {
    const res = await fetch(API_BASE + endpoint);
    return res.json();
  }

  function fmtPct(v) { return v.toFixed(1) + "%"; }
  function fmtNum(v) { return v.toFixed(2); }
</script>

{% block scripts %}{% endblock %}
</body>
</html>