Spaces:
Runtime error
Runtime error
Commit
Β·
1498fe3
1
Parent(s):
dd66345
update
Browse files- app.py +3 -5
- templates/experiment.html +2 -40
- templates/index.html +0 -11
app.py
CHANGED
@@ -204,9 +204,7 @@ def index():
|
|
204 |
return "No samples were selected", 500
|
205 |
|
206 |
start_time = datetime.now().isoformat()
|
207 |
-
session_id = f"{username}_{start_time}" # Create a unique session ID
|
208 |
session_data = {
|
209 |
-
'session_id': session_id,
|
210 |
'username': username,
|
211 |
'seed': seed, # Store as string
|
212 |
'methods': methods,
|
@@ -215,10 +213,10 @@ def index():
|
|
215 |
'responses': [],
|
216 |
'start_time': start_time
|
217 |
}
|
218 |
-
save_session_data(
|
219 |
-
logger.info(f"
|
220 |
|
221 |
-
return redirect(url_for('experiment',
|
222 |
except Exception as e:
|
223 |
logger.exception(f"Error in index route: {e}")
|
224 |
return "An error occurred", 500
|
|
|
204 |
return "No samples were selected", 500
|
205 |
|
206 |
start_time = datetime.now().isoformat()
|
|
|
207 |
session_data = {
|
|
|
208 |
'username': username,
|
209 |
'seed': seed, # Store as string
|
210 |
'methods': methods,
|
|
|
213 |
'responses': [],
|
214 |
'start_time': start_time
|
215 |
}
|
216 |
+
save_session_data(username, session_data)
|
217 |
+
logger.info(f"Session data initialized for user: {username}")
|
218 |
|
219 |
+
return redirect(url_for('experiment', username=username))
|
220 |
except Exception as e:
|
221 |
logger.exception(f"Error in index route: {e}")
|
222 |
return "An error occurred", 500
|
templates/experiment.html
CHANGED
@@ -95,34 +95,6 @@
|
|
95 |
height: 100%;
|
96 |
border: none;
|
97 |
}
|
98 |
-
.loader {
|
99 |
-
border: 5px solid #f3f3f3;
|
100 |
-
border-top: 5px solid #3498db;
|
101 |
-
border-radius: 50%;
|
102 |
-
width: 50px;
|
103 |
-
height: 50px;
|
104 |
-
animation: spin 1s linear infinite;
|
105 |
-
position: fixed;
|
106 |
-
top: 50%;
|
107 |
-
left: 50%;
|
108 |
-
transform: translate(-50%, -50%);
|
109 |
-
display: none;
|
110 |
-
z-index: 1000;
|
111 |
-
}
|
112 |
-
@keyframes spin {
|
113 |
-
0% { transform: translate(-50%, -50%) rotate(0deg); }
|
114 |
-
100% { transform: translate(-50%, -50%) rotate(360deg); }
|
115 |
-
}
|
116 |
-
.overlay {
|
117 |
-
position: fixed;
|
118 |
-
top: 0;
|
119 |
-
left: 0;
|
120 |
-
width: 100%;
|
121 |
-
height: 100%;
|
122 |
-
background-color: rgba(0, 0, 0, 0.5);
|
123 |
-
display: none;
|
124 |
-
z-index: 999;
|
125 |
-
}
|
126 |
</style>
|
127 |
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;700&display=swap" rel="stylesheet">
|
128 |
</head>
|
@@ -144,25 +116,15 @@
|
|
144 |
<p class="question-text">Which explanation provides a clearer and more accurate reasoning process?</p>
|
145 |
</div>
|
146 |
<div class="buttons">
|
147 |
-
<form action="{{ url_for('feedback') }}" method="post" style="width: 48%;"
|
148 |
<input type="hidden" name="username" value="{{ username }}">
|
149 |
<button type="submit" name="feedback" value="{{ method_a }}">{{ method_a }}</button>
|
150 |
</form>
|
151 |
-
<form action="{{ url_for('feedback') }}" method="post" style="width: 48%;"
|
152 |
<input type="hidden" name="username" value="{{ username }}">
|
153 |
<button type="submit" name="feedback" value="{{ method_b }}">{{ method_b }}</button>
|
154 |
</form>
|
155 |
</div>
|
156 |
</div>
|
157 |
-
|
158 |
-
<div class="overlay" id="overlay"></div>
|
159 |
-
<div class="loader" id="loader"></div>
|
160 |
-
|
161 |
-
<script>
|
162 |
-
function showLoader() {
|
163 |
-
document.getElementById('overlay').style.display = 'block';
|
164 |
-
document.getElementById('loader').style.display = 'block';
|
165 |
-
}
|
166 |
-
</script>
|
167 |
</body>
|
168 |
</html>
|
|
|
95 |
height: 100%;
|
96 |
border: none;
|
97 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
98 |
</style>
|
99 |
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;700&display=swap" rel="stylesheet">
|
100 |
</head>
|
|
|
116 |
<p class="question-text">Which explanation provides a clearer and more accurate reasoning process?</p>
|
117 |
</div>
|
118 |
<div class="buttons">
|
119 |
+
<form action="{{ url_for('feedback') }}" method="post" style="width: 48%;">
|
120 |
<input type="hidden" name="username" value="{{ username }}">
|
121 |
<button type="submit" name="feedback" value="{{ method_a }}">{{ method_a }}</button>
|
122 |
</form>
|
123 |
+
<form action="{{ url_for('feedback') }}" method="post" style="width: 48%;">
|
124 |
<input type="hidden" name="username" value="{{ username }}">
|
125 |
<button type="submit" name="feedback" value="{{ method_b }}">{{ method_b }}</button>
|
126 |
</form>
|
127 |
</div>
|
128 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
129 |
</body>
|
130 |
</html>
|
templates/index.html
CHANGED
@@ -26,14 +26,6 @@
|
|
26 |
font-size: 48px;
|
27 |
margin-bottom: 30px;
|
28 |
}
|
29 |
-
.instruction {
|
30 |
-
font-size: 20px;
|
31 |
-
color: #333;
|
32 |
-
margin-bottom: 30px;
|
33 |
-
padding: 15px;
|
34 |
-
background-color: #f0f0f0;
|
35 |
-
border-radius: 5px;
|
36 |
-
}
|
37 |
label {
|
38 |
display: block;
|
39 |
margin: 20px 0 10px;
|
@@ -148,9 +140,6 @@
|
|
148 |
<body>
|
149 |
<div class="container">
|
150 |
<h1>Trustworthy LLMs for Table QA</h1>
|
151 |
-
<div class="instruction">
|
152 |
-
Let's get started! Please input your name, enter a random number as your seed, and select 2 methods for your experiment.
|
153 |
-
</div>
|
154 |
<form id="method-form" action="/" method="post" onsubmit="return validateForm();">
|
155 |
<label for="username">Hi there πππ ! What is your name?</label>
|
156 |
<input type="text" id="username" name="username" required>
|
|
|
26 |
font-size: 48px;
|
27 |
margin-bottom: 30px;
|
28 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
label {
|
30 |
display: block;
|
31 |
margin: 20px 0 10px;
|
|
|
140 |
<body>
|
141 |
<div class="container">
|
142 |
<h1>Trustworthy LLMs for Table QA</h1>
|
|
|
|
|
|
|
143 |
<form id="method-form" action="/" method="post" onsubmit="return validateForm();">
|
144 |
<label for="username">Hi there πππ ! What is your name?</label>
|
145 |
<input type="text" id="username" name="username" required>
|