File size: 3,598 Bytes
4c5156b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
111
112
113
114
115
116
117
118
119
120
121
<!DOCTYPE html>
<html>
<head>
    <title>BERT Predictions</title>
    <style>
        body {
            background-color: #f0f0f0; /* Light grey background */
            font-family: Arial, sans-serif;
            padding: 20px;
            text-align: center; /* Center align content */
        }
        h2 {
            color: #333;
        }
        .input-container {
            max-width: 600px;
            margin: 0 auto; /* Center align container */
            background-color: #fff;
            padding: 20px;
            border-radius: 8px;
            box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
            margin-bottom: 20px;
        }
        textarea {
            width: 100%;
            padding: 10px;
            font-size: 16px;
            margin-bottom: 10px;
        }
        input[type="submit"] {
            padding: 10px 20px;
            font-size: 16px;
            background-color: #4CAF50; /* Green submit button */
            color: white;
            border: none;
            cursor: pointer;
        }
        input[type="submit"]:hover {
            background-color: #45a049; /* Darker green on hover */
        }
        .predictions {
            text-align: center; /* Center align predictions */
            margin-top: 20px;
        }
        .prediction-item {
            margin-bottom: 10px;
            padding-left: 20px;
            font-size: 18px;
            display: inline-block; /* Ensure items stay inline */
            text-align: left; /* Align text left within each item */
        }
        .icon {
            font-size: 20px;
            margin-right: 10px;
            vertical-align: middle;
        }
        .category-price {
            color: #1f77b4; /* Blue */
        }
        .category-packaging {
            color: #ff7f0e; /* Orange */
        }
        .category-product {
            color: #2ca02c; /* Green */
        }
        .category-rider {
            color: #d62728; /* Red */
        }
        .category-delivery {
            color: #9467bd; /* Purple */
        }
        .category-shelf {
            color: #8c564b; /* Brown */
        }
        .category-service {
            color: #e377c2; /* Pink */
        }
        .category-seller {
            color: #7f7f7f; /* Grey */
        }
    </style>
    <script>
        function validateForm() {
            var text = document.forms["predictForm"]["text"].value.trim();
            if (text == "") {
                alert("Please enter some text");
                return false;
            }
            return true;
        }

        function clearPredictions() {
            var predictionsDiv = document.querySelector('.predictions');
            if (predictionsDiv) {
                predictionsDiv.innerHTML = ''; // Clear previous predictions
            }
        }
    </script>
</head>
<body>
    <div class="input-container">
        <h2>Enter Text to Predict Multi-Label Classification</h2>
        <form name="predictForm" method="post" onsubmit="clearPredictions(); return validateForm()">
            <textarea name="text" rows="4" cols="50"></textarea><br><br>
            <input type="submit" value="Predict">
        </form>
    </div>
    
    {% if predictions %}
        <div class="predictions">
            <h3>Predicted Categories:</h3>
            {% for prediction in predictions %}
                <div class="prediction-item category-{{ prediction }}">
                    <span class="icon"></span>{{ prediction }}
                </div>
            {% endfor %}
        </div>
    {% endif %}
</body>
</html>