File size: 3,438 Bytes
10032c3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Web Scraper</title>
    <link rel="stylesheet" href="/static/style.css">
</head>
<body>
    <header>
        <h1>Web Scraper</h1>
        <p>ML-based content classification</p>
    </header>

    <nav class="tabs">
        <button class="tab-btn active" data-tab="scrape">Scrape</button>
        <button class="tab-btn" data-tab="jobs">Jobs</button>
        <button class="tab-btn" data-tab="pages">Pages</button>
        <button class="tab-btn" data-tab="stats">Stats</button>
        <button class="tab-btn" data-tab="model">Model</button>
    </nav>

    <main>
        <section id="scrape" class="tab-content active">
            <h2>Submit Scraping Job</h2>
            <form id="scrape-form">
                <label for="urls">URLs (one per line):</label>
                <textarea id="urls" rows="5" placeholder="https://example.com&#10;https://news.ycombinator.com"></textarea>
                <button type="submit">Start Scraping</button>
            </form>
            <div id="scrape-result" class="result"></div>
        </section>

        <section id="jobs" class="tab-content">
            <h2>Job Status</h2>
            <div class="form-row">
                <input type="text" id="job-id-input" placeholder="Enter Job ID">
                <button id="check-job-btn">Check Status</button>
            </div>
            <div id="job-result" class="result"></div>
        </section>

        <section id="pages" class="tab-content">
            <h2>Scraped Pages</h2>
            <div class="filters">
                <select id="status-filter">
                    <option value="">All Pages</option>
                    <option value="success">Successful</option>
                    <option value="error">Errors</option>
                </select>
                <button id="refresh-pages-btn">Refresh</button>
            </div>
            <table id="pages-table">
                <thead>
                    <tr>
                        <th>ID</th>
                        <th>URL</th>
                        <th>Title</th>
                        <th>Category</th>
                        <th>Status</th>
                    </tr>
                </thead>
                <tbody></tbody>
            </table>
            <div id="page-detail" class="modal hidden"></div>
        </section>

        <section id="stats" class="tab-content">
            <h2>Statistics</h2>
            <div id="stats-content" class="stats-grid"></div>
        </section>

        <section id="model" class="tab-content">
            <h2>ML Model</h2>
            <div class="model-actions">
                <button id="retrain-btn">Retrain Model</button>
                <button id="vacuum-btn">Vacuum Database</button>
            </div>
            <div id="model-result" class="result"></div>

            <h3>Predict Content</h3>
            <form id="predict-form">
                <textarea id="html-content" rows="5" placeholder="<html>...</html>"></textarea>
                <input type="text" id="predict-title" placeholder="Title (optional)">
                <button type="submit">Classify</button>
            </form>
            <div id="predict-result" class="result"></div>
        </section>
    </main>

    <script src="/static/app.js"></script>
</body>
</html>