<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<title>Sentiment Classification</title> | |
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous"> | |
</head> | |
<body> | |
<div class="container"> | |
<h1 class="text-center mb-3">Sentiment Classification</h1> | |
<form method="POST" class="row justify-content-center"> | |
<div class="col-md-12"> | |
<textarea name="user_input" class="form-control" rows="5" cols="30" placeholder="Enter your input here..." required></textarea> | |
</div> | |
<div class="col-md-2"> | |
<button type="submit" class="btn btn-primary">Submit</button> | |
</div> | |
</form> | |
{% if user_input %} | |
<h2 class="mt-5 text-center">Sentiment Analysis Results:</h2> | |
<p class="mt-2 text-center">{{user_input}}</p> | |
<div class="col-md-12 text-center"> | |
<table class="table "> | |
<thead> | |
<tr> | |
<th>Label</th> | |
<th>Score</th> | |
</tr> | |
</thead> | |
<tbody> | |
{% for items in response %} | |
{% for item in items %} | |
<tr> | |
<td class="text-capitalize">{{ item.label }}</td> | |
<td>{{ item.score }}</td> | |
</tr> | |
{% endfor %} | |
{% endfor %} | |
</tbody> | |
</table> | |
</div> | |
{% endif %} | |
</div> | |
</body> | |
</html> | |