Spaces:
Runtime error
Runtime error
Commit ·
8b0f70d
1
Parent(s): e75202e
update
Browse files- templates/experiment.html +75 -117
templates/experiment.html
CHANGED
|
@@ -3,132 +3,56 @@
|
|
| 3 |
<head>
|
| 4 |
<title>Table QA Experiment</title>
|
| 5 |
<style>
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
}
|
| 12 |
-
.container {
|
| 13 |
-
max-width: 1200px;
|
| 14 |
-
margin: 0 auto;
|
| 15 |
-
background-color: white;
|
| 16 |
-
padding: 20px;
|
| 17 |
-
border-radius: 10px;
|
| 18 |
-
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
|
| 19 |
-
}
|
| 20 |
-
h1 {
|
| 21 |
-
text-align: center;
|
| 22 |
-
color: #333;
|
| 23 |
-
margin-bottom: 30px;
|
| 24 |
-
}
|
| 25 |
-
.progress {
|
| 26 |
-
text-align: center;
|
| 27 |
-
font-size: 1.2em;
|
| 28 |
-
color: #666;
|
| 29 |
-
margin-bottom: 20px;
|
| 30 |
-
}
|
| 31 |
-
.explanations-grid {
|
| 32 |
-
display: grid;
|
| 33 |
-
grid-template-columns: repeat(2, 1fr);
|
| 34 |
-
gap: 20px;
|
| 35 |
-
margin-bottom: 40px;
|
| 36 |
-
}
|
| 37 |
-
.explanation-card {
|
| 38 |
-
border: 1px solid #ddd;
|
| 39 |
-
border-radius: 8px;
|
| 40 |
-
overflow: hidden;
|
| 41 |
-
}
|
| 42 |
-
.explanation-header {
|
| 43 |
-
background-color: #f8f9fa;
|
| 44 |
-
padding: 15px;
|
| 45 |
-
border-bottom: 1px solid #ddd;
|
| 46 |
-
}
|
| 47 |
-
.explanation-header h2 {
|
| 48 |
-
margin: 0;
|
| 49 |
-
color: #333;
|
| 50 |
-
font-size: 1.2em;
|
| 51 |
-
}
|
| 52 |
-
.explanation-content {
|
| 53 |
-
padding: 0;
|
| 54 |
-
}
|
| 55 |
-
iframe {
|
| 56 |
-
width: 100%;
|
| 57 |
-
height: 500px;
|
| 58 |
-
border: none;
|
| 59 |
-
}
|
| 60 |
-
.ranking-section {
|
| 61 |
-
position: sticky;
|
| 62 |
-
bottom: 0;
|
| 63 |
-
background: white;
|
| 64 |
-
padding: 20px;
|
| 65 |
-
border-top: 3px solid #4CAF50;
|
| 66 |
-
box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
|
| 67 |
-
margin-top: 40px;
|
| 68 |
-
}
|
| 69 |
-
.ranking-grid {
|
| 70 |
-
display: grid;
|
| 71 |
-
grid-template-columns: repeat(4, 1fr);
|
| 72 |
-
gap: 15px;
|
| 73 |
-
margin: 20px 0;
|
| 74 |
-
}
|
| 75 |
-
.ranking-item {
|
| 76 |
-
background: #f8f9fa;
|
| 77 |
-
padding: 15px;
|
| 78 |
-
border-radius: 8px;
|
| 79 |
-
text-align: center;
|
| 80 |
-
}
|
| 81 |
-
.ranking-item label {
|
| 82 |
-
display: block;
|
| 83 |
-
margin-bottom: 10px;
|
| 84 |
-
font-weight: bold;
|
| 85 |
-
color: #333;
|
| 86 |
-
}
|
| 87 |
-
.ranking-item input {
|
| 88 |
-
width: 60px;
|
| 89 |
padding: 8px;
|
| 90 |
border: 2px solid #ddd;
|
| 91 |
border-radius: 4px;
|
| 92 |
text-align: center;
|
| 93 |
font-size: 1.1em;
|
| 94 |
-
|
| 95 |
-
.submit-button {
|
| 96 |
-
background-color: #4CAF50;
|
| 97 |
-
color: white;
|
| 98 |
-
padding: 15px 30px;
|
| 99 |
-
border: none;
|
| 100 |
-
border-radius: 5px;
|
| 101 |
cursor: pointer;
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 106 |
}
|
| 107 |
-
|
| 108 |
-
|
|
|
|
|
|
|
|
|
|
| 109 |
}
|
| 110 |
-
|
| 111 |
-
|
| 112 |
-
border-
|
| 113 |
-
padding: 15px;
|
| 114 |
-
margin-bottom: 20px;
|
| 115 |
-
border-radius: 4px;
|
| 116 |
}
|
| 117 |
-
|
| 118 |
-
|
| 119 |
-
|
| 120 |
-
|
| 121 |
-
|
| 122 |
-
|
| 123 |
-
|
| 124 |
-
|
|
|
|
|
|
|
| 125 |
}
|
| 126 |
</style>
|
| 127 |
</head>
|
| 128 |
<body>
|
|
|
|
|
|
|
| 129 |
<div class="container">
|
| 130 |
<div class="progress">Sample {{ sample_id + 1 }} of 10</div>
|
| 131 |
-
|
| 132 |
<div class="instructions">
|
| 133 |
<h3>Ranking Instructions:</h3>
|
| 134 |
<p>Please examine each explanation method and rank them based on:</p>
|
|
@@ -159,7 +83,13 @@
|
|
| 159 |
{% for method in methods %}
|
| 160 |
<div class="ranking-item">
|
| 161 |
<label for="{{ method }}">{{ method }}</label>
|
| 162 |
-
<
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 163 |
</div>
|
| 164 |
{% endfor %}
|
| 165 |
</div>
|
|
@@ -170,15 +100,37 @@
|
|
| 170 |
</div>
|
| 171 |
|
| 172 |
<script>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 173 |
function validateRankings() {
|
| 174 |
const rankings = new Set();
|
| 175 |
const form = document.getElementById('rankingForm');
|
| 176 |
const errorMessage = document.getElementById('errorMessage');
|
| 177 |
-
|
| 178 |
-
|
| 179 |
-
|
| 180 |
-
|
| 181 |
-
|
|
|
|
| 182 |
errorMessage.style.display = 'block';
|
| 183 |
return false;
|
| 184 |
}
|
|
@@ -193,6 +145,12 @@
|
|
| 193 |
|
| 194 |
return true;
|
| 195 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 196 |
</script>
|
| 197 |
</body>
|
| 198 |
</html>
|
|
|
|
| 3 |
<head>
|
| 4 |
<title>Table QA Experiment</title>
|
| 5 |
<style>
|
| 6 |
+
/* Keep all existing styles */
|
| 7 |
+
|
| 8 |
+
/* Add new styles for the dropdown */
|
| 9 |
+
.ranking-item select {
|
| 10 |
+
width: 80px;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
padding: 8px;
|
| 12 |
border: 2px solid #ddd;
|
| 13 |
border-radius: 4px;
|
| 14 |
text-align: center;
|
| 15 |
font-size: 1.1em;
|
| 16 |
+
background-color: white;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
cursor: pointer;
|
| 18 |
+
appearance: none; /* Remove default arrow */
|
| 19 |
+
-webkit-appearance: none;
|
| 20 |
+
-moz-appearance: none;
|
| 21 |
+
background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
|
| 22 |
+
background-repeat: no-repeat;
|
| 23 |
+
background-position: right 8px center;
|
| 24 |
+
background-size: 16px;
|
| 25 |
+
padding-right: 30px;
|
| 26 |
}
|
| 27 |
+
|
| 28 |
+
.ranking-item select:focus {
|
| 29 |
+
outline: none;
|
| 30 |
+
border-color: #4CAF50;
|
| 31 |
+
box-shadow: 0 0 0 2px rgba(74, 175, 80, 0.2);
|
| 32 |
}
|
| 33 |
+
|
| 34 |
+
.ranking-item select:hover {
|
| 35 |
+
border-color: #4CAF50;
|
|
|
|
|
|
|
|
|
|
| 36 |
}
|
| 37 |
+
|
| 38 |
+
/* Style for the selected option */
|
| 39 |
+
.ranking-item select option {
|
| 40 |
+
padding: 8px;
|
| 41 |
+
font-size: 1.1em;
|
| 42 |
+
}
|
| 43 |
+
|
| 44 |
+
/* Highlight used ranks */
|
| 45 |
+
.used-rank {
|
| 46 |
+
background-color: #e8f5e9 !important;
|
| 47 |
}
|
| 48 |
</style>
|
| 49 |
</head>
|
| 50 |
<body>
|
| 51 |
+
<!-- Keep existing container, progress, and instructions -->
|
| 52 |
+
|
| 53 |
<div class="container">
|
| 54 |
<div class="progress">Sample {{ sample_id + 1 }} of 10</div>
|
| 55 |
+
|
| 56 |
<div class="instructions">
|
| 57 |
<h3>Ranking Instructions:</h3>
|
| 58 |
<p>Please examine each explanation method and rank them based on:</p>
|
|
|
|
| 83 |
{% for method in methods %}
|
| 84 |
<div class="ranking-item">
|
| 85 |
<label for="{{ method }}">{{ method }}</label>
|
| 86 |
+
<select id="{{ method }}" name="{{ method }}" required onchange="updateRankings(this)">
|
| 87 |
+
<option value="" selected disabled>Select Rank</option>
|
| 88 |
+
<option value="1">1 (Best)</option>
|
| 89 |
+
<option value="2">2</option>
|
| 90 |
+
<option value="3">3</option>
|
| 91 |
+
<option value="4">4 (Worst)</option>
|
| 92 |
+
</select>
|
| 93 |
</div>
|
| 94 |
{% endfor %}
|
| 95 |
</div>
|
|
|
|
| 100 |
</div>
|
| 101 |
|
| 102 |
<script>
|
| 103 |
+
function updateRankings(changedSelect) {
|
| 104 |
+
const allSelects = document.querySelectorAll('select');
|
| 105 |
+
const usedRanks = new Set();
|
| 106 |
+
|
| 107 |
+
// Collect all currently selected values
|
| 108 |
+
allSelects.forEach(select => {
|
| 109 |
+
if (select.value) {
|
| 110 |
+
usedRanks.add(select.value);
|
| 111 |
+
}
|
| 112 |
+
});
|
| 113 |
+
|
| 114 |
+
// Update all selects to disable used options
|
| 115 |
+
allSelects.forEach(select => {
|
| 116 |
+
Array.from(select.options).forEach(option => {
|
| 117 |
+
if (option.value && option.value !== select.value) {
|
| 118 |
+
option.disabled = usedRanks.has(option.value);
|
| 119 |
+
}
|
| 120 |
+
});
|
| 121 |
+
});
|
| 122 |
+
}
|
| 123 |
+
|
| 124 |
function validateRankings() {
|
| 125 |
const rankings = new Set();
|
| 126 |
const form = document.getElementById('rankingForm');
|
| 127 |
const errorMessage = document.getElementById('errorMessage');
|
| 128 |
+
const selects = form.getElementsByTagName('select');
|
| 129 |
+
|
| 130 |
+
for (const select of selects) {
|
| 131 |
+
const value = select.value;
|
| 132 |
+
if (!value) {
|
| 133 |
+
errorMessage.textContent = 'Please assign a rank to all methods.';
|
| 134 |
errorMessage.style.display = 'block';
|
| 135 |
return false;
|
| 136 |
}
|
|
|
|
| 145 |
|
| 146 |
return true;
|
| 147 |
}
|
| 148 |
+
|
| 149 |
+
// Initialize dropdowns on page load
|
| 150 |
+
document.addEventListener('DOMContentLoaded', function() {
|
| 151 |
+
const selects = document.querySelectorAll('select');
|
| 152 |
+
selects.forEach(select => updateRankings(select));
|
| 153 |
+
});
|
| 154 |
</script>
|
| 155 |
</body>
|
| 156 |
</html>
|