photo/templates/upload.html

39 lines
1.5 KiB
HTML

<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>上传照片</title>
<link rel="stylesheet" href="{{ url_for('static', filename='styles.css') }}">
</head>
<body>
<div class="container">
<h1>上传照片并进行分类</h1>
<!-- 上传照片表单 -->
<form action="{{ url_for('upload') }}" method="POST" enctype="multipart/form-data">
<div class="form-group">
<label for="photos">选择照片:</label>
<input type="file" id="photos" name="photos" multiple accept="image/*" required>
</div>
<button type="submit" class="btn">上传照片</button>
</form>
{% if photos %}
<h2>分类结果:</h2>
<div class="photo-gallery">
{% for photo in photos %}
<div class="photo-item">
<img src="{{ url_for('static', filename=photo['filename'].replace('static/', '')) }}" alt="分类照片">
<p><strong>姓名:</strong> {{ photo['username'] }}</p>
<p><strong>时间:</strong> {{ photo['created_at'] }}</p>
</div>
{% endfor %}
</div>
{% else %}
<p style="margin-top: 20px; font-size: 18px; color: gray;">暂无分类结果,请上传照片。</p>
{% endif %}
</div>
</body>
</html>