age-gender-app / templates /index.html
vola2004's picture
Upload 3 files
efbc6bc verified
Raw
History Blame
3.89 kB
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>年代・性別予測アプリケーション</title>
<style>
body {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
background-color: #f4f7f6;
color: #333;
max-width: 700px;
margin: 40px auto;
padding: 20px;
box-shadow: 0 4px 8px rgba(0,0,0,0.05);
border-radius: 8px;
background: #fff;
}
h1 {
text-align: center;
color: #2c3e50;
border-bottom: 2px solid #3498db;
padding-bottom: 10px;
}
textarea {
width: 100%;
height: 120px;
padding: 10px;
border-radius: 5px;
border: 1px solid #ccc;
font-size: 16px;
box-sizing: border-box;
margin-bottom: 15px;
resize: vertical;
}
.btn-container {
text-align: center;
}
.btn {
background-color: #3498db;
color: white;
padding: 12px 25px;
border: none;
border-radius: 5px;
cursor: pointer;
font-size: 16px;
transition: background-color 0.3s;
}
.btn:hover {
background-color: #2980b9;
}
.result-container {
margin-top: 30px;
background-color: #ecf0f1;
padding: 20px;
border-radius: 5px;
border-left: 5px solid #3498db;
}
h2 {
margin-top: 0;
color: #2c3e50;
}
.result p {
font-size: 18px;
margin: 10px 0;
}
.result strong {
display: inline-block;
width: 80px;
}
.error {
color: #e74c3c;
font-weight: bold;
}
.original-text {
background: #fdfdfd;
padding: 10px;
border-radius: 3px;
border: 1px solid #ddd;
margin-top: 5px;
white-space: pre-wrap;
word-wrap: break-word;
}
</style>
</head>
<body>
<h1>年代・性別予測アプリケーション</h1>
<p style="text-align: center; color: #7f8c8d;">※ 推測結果は統計的予測であり、必ずしも正確ではありません。</p>
<form action="/" method="post">
<textarea name="text" placeholder="商品レビューを記入">{{ input_text or '' }}</textarea>
<div class="btn-container">
<button class="btn" type="submit">予測する</button>
</div>
</form>
{% if history %}
<div class="history-container">
<h2>予測履歴</h2>
{% for prediction in history %}
<div class="result-container">
<p><strong>入力された文章:</strong></p>
<p class="original-text">{{ prediction.input_text }}</p>
<hr>
<p><strong>予測結果:</strong></p>
<p><strong>年代の確率:</strong></p>
<ul>
{% for age, prob in prediction.age_percentages.items() %}
<li>{{ age }}: {{ "%.2f"|format(prob) }}%</li>
{% endfor %}
</ul>
<p><strong>性別の確率:</strong></p>
<ul>
{% for gender, prob in prediction.gender_percentages.items() %}
<li>{{ gender }}: {{ "%.2f"|format(prob) }}%</li>
{% endfor %}
</ul>
</div>
{% endfor %}
</div>
{% endif %}
</body>
</html>