|
<!DOCTYPE html> |
|
<html> |
|
<head> |
|
<title>BERT Predictions</title> |
|
<style> |
|
body { |
|
background-color: #f0f0f0; |
|
font-family: Arial, sans-serif; |
|
padding: 20px; |
|
text-align: center; |
|
} |
|
h2 { |
|
color: #333; |
|
} |
|
.input-container { |
|
max-width: 600px; |
|
margin: 0 auto; |
|
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; |
|
color: white; |
|
border: none; |
|
cursor: pointer; |
|
} |
|
input[type="submit"]:hover { |
|
background-color: #45a049; |
|
} |
|
.predictions { |
|
text-align: center; |
|
margin-top: 20px; |
|
} |
|
.prediction-item { |
|
margin-bottom: 10px; |
|
padding-left: 20px; |
|
font-size: 18px; |
|
display: inline-block; |
|
text-align: left; |
|
} |
|
.icon { |
|
font-size: 20px; |
|
margin-right: 10px; |
|
vertical-align: middle; |
|
} |
|
.category-price { |
|
color: #1f77b4; |
|
} |
|
.category-packaging { |
|
color: #ff7f0e; |
|
} |
|
.category-product { |
|
color: #2ca02c; |
|
} |
|
.category-rider { |
|
color: #d62728; |
|
} |
|
.category-delivery { |
|
color: #9467bd; |
|
} |
|
.category-shelf { |
|
color: #8c564b; |
|
} |
|
.category-service { |
|
color: #e377c2; |
|
} |
|
.category-seller { |
|
color: #7f7f7f; |
|
} |
|
</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 = ''; |
|
} |
|
} |
|
</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> |
|
|