Plankton_Detector/PlanktonDetector/templates/results.html

41 lines
1.6 KiB
HTML
Raw Normal View History

2023-12-19 17:33:46 +01:00
{% extends 'base.html' %}
{%load static%}
{%block extracss%}
<link rel="stylesheet" href="{%static 'DetectionApp/css/results.css' %}">
{%endblock extracss%}
{%block content%}
<form method="POST" enctype="multipart/form-data">
{% csrf_token %}
<div class="side_menu">
{% if not user.is_authenticated %}
<p id="description">Please login to see results</p>
<a href="{% url 'login'%}?next={{request.path}}" id="submit">Login</a>
2023-12-19 17:33:46 +01:00
{% else %}
<p id="description">Results:</p>
{%for img in img.images.all %}
2023-12-23 17:01:39 +01:00
<p class="image_number">Image {{forloop.counter}}</p>
{%for detection in img.get_prediction_data%}
<div class="results">
2024-01-14 23:12:35 +01:00
<p class="detection_info">{{detection.class}}: {{detection.confidence}}%</p>
2023-12-23 17:01:39 +01:00
</div>
{%endfor%}
{%endfor%}
<a href="{% url 'detect' %}" id="submit">Submit again</a>
2023-12-19 17:33:46 +01:00
{%endif%}
</div>
<div class="upload_field">
<label>
{%for img in img.images.all %}
2023-12-23 17:01:39 +01:00
<img src="{{img.image.url}}" alt="upload_image" style="width:640px; height:460px;">
2023-12-19 17:33:46 +01:00
{%endfor%}
</label>
<a href="{%url 'download_predicitions' pk=img.id %}" id="download_json">Export predictions</a>
2023-12-19 17:33:46 +01:00
</div>
</form>
2023-12-23 17:01:39 +01:00
<script>
var results=document.getElementsByClassName("results")
for (var i = 0; i < results.length; i++){
results[i].style.background=`linear-gradient(90deg, #7fff00 ${results[i].textContent.split(":")[1]}, #FFFFFF 0%)`
};
</script>
2023-12-19 17:33:46 +01:00
{%endblock content%}