Do batch prediction.

Do batch prediction inside the `predict` method instead of calling
`predict` once for each image.
This commit is contained in:
evazion
2022-06-21 20:08:14 -05:00
parent 5c90c7378d
commit 07b84d73fe
4 changed files with 30 additions and 16 deletions
+4 -4
View File
@@ -9,15 +9,15 @@
<a class="text-xs text-sky-600 hover:text-sky-500 mr-4" href="/">&lt; Back</a>
<div class="mt-4">
{% for prediction in predictions %}
{% for base64data, tags in predictions %}
<div class="flex flex-col p-2 gap-2 border rounded md:flex-row md:max-h-[80vh]">
<div class="flex-1 flex items-center justify-center">
<img class="max-w-full max-h-full h-auto" src="data:image/jpg;base64,{{ prediction["data"] | safe }}">
<img class="max-w-full max-h-full h-auto" src="data:image/jpg;base64,{{ base64data | safe }}">
</div>
<div class="flex-0 overflow-scroll md:pr-2">
<table class="w-full leading-4">
{% for tag, score in prediction["tags"].items() %}
{% for tag, score in tags.items() %}
<tr>
<td>
<a class="text-sky-600 hover:text-sky-500" href="https://danbooru.donmai.us/wiki_pages/{{ tag | urlencode }}">?</a>
@@ -28,7 +28,7 @@
{% endfor %}
</table>
<textarea class="w-full text-gray-500 mt-2" rows="4">{{ " ".join(prediction["tags"].keys()) }}</textarea>
<textarea class="w-full text-gray-500 mt-2" rows="4">{{ " ".join(tags.keys()) }}</textarea>
</div>
</div>
{% endfor %}