Plankton_Detector/PlanktonDetector/templates/results.html

41 lines
1.8 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>
<button onclick="location.href='{% url 'login' %}'" id='submit' method="GET" type='button'>Login</button>
{% 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">
<p class="detection_info">{{detection.name}}: {{detection.confidence}}%</p>
</div>
{%endfor%}
{%endfor%}
2023-12-19 17:33:46 +01:00
<button onclick="location.href='{% url 'detect' %}'" id='submit' method="GET" type='button'>Submit again</button>
{%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>
<button onclick="location.href='{%url 'download_predicitons' pk=img.id%}'" id="download_json" method="GET" type="button">Export predictions</button>
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%}