Получается у меня есть список изображений 1, 2, 3, 4 и т.д., каждое из изображений я прогоняю через тесты и получаю различные метрики
К метрике у меня есть вывод(как в консоли, так и в тхт файле, поэтому откуда брать инфу непринципиально):
- Image1 = 99
- Image2 = 98
- Image3 = 99
Metric2
- Image1 = 0.9
- Image2 = 0.8
- Image3 = 0.9
Metric3
- Image1 = True
- Image2 = True
- Image3 = False
Как его правильно добавить во flask? Ниже приведу пример, как я отображаю изображения с именем.
hml<body>
<div class="container">
<div class="row">
<div class="col-lg-12">
<h1 class="page-header">Images monitor</h1>
</div>
<hr>
{% for file, encode_file in paths.items() %}
<div class="col-lg-3 col-md-4 col-xs-6 thumb">
<img class="img-responsive" src='{{ encode_file }}' height=100% width=100% onclick="clicked_img(this)" >
<div class="desc">{{ file }}</div>
<div class="card-body">
<p class="card-text">Metric1 =
Metric2 =
Metric3 = </p>
<div class="d-flex justify-content-between align-items-center">
<div class="btn-group">
<button type="button" onclick="window.open('https://google.com')" class="btn btn-sm btn-outline-secondary">LINK</button>
<button type="button" onclick="location.href='https://google.com';" class="btn btn-sm btn-outline-secondary">LINK</button>
<button type="button" onclick="location.href='https://google.com';" class="btn btn-sm btn-outline-secondary">LINK</button>
<hr>
</div>
</div>
</div>
</div>
{% endfor %}
</div>
</div>
</body>
python@app.route('/demo.html')
def demo():
folders = "/Users/elgars.dorosko/Desktop/Demo"
print(folders)
root_dir = folders
image_paths = {}
for root,dirs,files in os.walk(root_dir):
for file in sorted(files):
if any(file.endswith(ext) for ext in app.config['IMAGE_EXTS']):
image_paths[file] = encode(os.path.join(root, file))
return render_template('demo.html', paths=image_paths)
Вот так выглядит отображение изображения с именем