bikas
Multi Labels
4c5156b
raw
history blame
No virus
3.6 kB
<!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>