Spaces:
Runtime error
Runtime error
luulinh90s
commited on
Commit
Β·
94b3f06
1
Parent(s):
ff51625
update
Browse files- app.py +14 -4
- templates/attribution.html +76 -0
- templates/index.html +3 -2
- templates/introduction.html +65 -0
app.py
CHANGED
@@ -113,9 +113,7 @@ def select_balanced_samples(samples):
|
|
113 |
except Exception as e:
|
114 |
logger.exception("Error selecting balanced samples")
|
115 |
return []
|
116 |
-
|
117 |
-
|
118 |
-
@app.route('/', methods=['GET', 'POST'])
|
119 |
def index():
|
120 |
if request.method == 'POST':
|
121 |
username = request.form.get('username')
|
@@ -153,7 +151,9 @@ def index():
|
|
153 |
except Exception as e:
|
154 |
logger.exception(f"Error in index route: {e}")
|
155 |
return "An error occurred", 500
|
156 |
-
|
|
|
|
|
157 |
|
158 |
|
159 |
@app.route('/experiment/<session_id>', methods=['GET', 'POST'])
|
@@ -266,6 +266,16 @@ def completed(session_id):
|
|
266 |
return "An error occurred", 500
|
267 |
|
268 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
269 |
@app.route('/visualizations/<path:filename>')
|
270 |
def send_visualization(filename):
|
271 |
logger.info(f"Attempting to serve file: {filename}")
|
|
|
113 |
except Exception as e:
|
114 |
logger.exception("Error selecting balanced samples")
|
115 |
return []
|
116 |
+
@app.route('/start', methods=['GET', 'POST'])
|
|
|
|
|
117 |
def index():
|
118 |
if request.method == 'POST':
|
119 |
username = request.form.get('username')
|
|
|
151 |
except Exception as e:
|
152 |
logger.exception(f"Error in index route: {e}")
|
153 |
return "An error occurred", 500
|
154 |
+
else:
|
155 |
+
return render_template('index.html')
|
156 |
+
|
157 |
|
158 |
|
159 |
@app.route('/experiment/<session_id>', methods=['GET', 'POST'])
|
|
|
266 |
return "An error occurred", 500
|
267 |
|
268 |
|
269 |
+
@app.route('/', methods=['GET'])
|
270 |
+
def introduction():
|
271 |
+
return render_template('introduction.html')
|
272 |
+
|
273 |
+
@app.route('/attribution', methods=['GET'])
|
274 |
+
def attribution():
|
275 |
+
return render_template('attribution.html')
|
276 |
+
|
277 |
+
|
278 |
+
|
279 |
@app.route('/visualizations/<path:filename>')
|
280 |
def send_visualization(filename):
|
281 |
logger.info(f"Attempting to serve file: {filename}")
|
templates/attribution.html
ADDED
@@ -0,0 +1,76 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<!DOCTYPE html>
|
2 |
+
<html>
|
3 |
+
<head>
|
4 |
+
<title>Attribution Explanations in TableQA</title>
|
5 |
+
<style>
|
6 |
+
/* Include your styles here */
|
7 |
+
body {
|
8 |
+
font-family: 'Roboto', sans-serif;
|
9 |
+
background: url('/static/images/background.jpg') no-repeat center center fixed;
|
10 |
+
background-size: cover;
|
11 |
+
display: flex;
|
12 |
+
justify-content: center;
|
13 |
+
align-items: center;
|
14 |
+
height: 100vh;
|
15 |
+
margin: 0;
|
16 |
+
}
|
17 |
+
.container {
|
18 |
+
text-align: center;
|
19 |
+
background-color: #ffffff;
|
20 |
+
padding: 60px;
|
21 |
+
border-radius: 10px;
|
22 |
+
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
|
23 |
+
width: 60%;
|
24 |
+
}
|
25 |
+
h1 {
|
26 |
+
color: #000000;
|
27 |
+
font-size: 48px;
|
28 |
+
margin-bottom: 30px;
|
29 |
+
}
|
30 |
+
p {
|
31 |
+
font-size: 20px;
|
32 |
+
color: #333;
|
33 |
+
margin-bottom: 30px;
|
34 |
+
}
|
35 |
+
img {
|
36 |
+
max-width: 100%;
|
37 |
+
height: auto;
|
38 |
+
margin-bottom: 30px;
|
39 |
+
}
|
40 |
+
button {
|
41 |
+
background-color: #4CAF50;
|
42 |
+
color: white;
|
43 |
+
padding: 15px 30px;
|
44 |
+
border: none;
|
45 |
+
border-radius: 5px;
|
46 |
+
cursor: pointer;
|
47 |
+
font-size: 24px;
|
48 |
+
transition: background-color 0.3s ease;
|
49 |
+
margin-top: 20px;
|
50 |
+
}
|
51 |
+
button:hover {
|
52 |
+
background-color: #45a049;
|
53 |
+
}
|
54 |
+
</style>
|
55 |
+
</head>
|
56 |
+
<body>
|
57 |
+
<div class="container">
|
58 |
+
<h1>Understanding Attribution Explanations</h1>
|
59 |
+
<p>
|
60 |
+
Attribution explanations highlight specific parts of a tableβsuch as rows, columns, or cellsβthat are most relevant to the answer provided by a TableQA system.
|
61 |
+
</p>
|
62 |
+
<p>
|
63 |
+
These explanations help you understand which data points the system considered important when generating the answer.
|
64 |
+
</p>
|
65 |
+
<!-- Include an example image if available -->
|
66 |
+
<!-- <img src="/static/images/attribution_example.png" alt="Attribution Example"> -->
|
67 |
+
<p>
|
68 |
+
For example, if the system answers "The highest sales were in June," the attribution might highlight the "June" row and the "Sales" column in the table.
|
69 |
+
</p>
|
70 |
+
<p>
|
71 |
+
During the experiment, you will compare different methods that provide these explanations.
|
72 |
+
</p>
|
73 |
+
<button onclick="location.href='{{ url_for('index') }}'">Proceed to Experiment</button>
|
74 |
+
</div>
|
75 |
+
</body>
|
76 |
+
</html>
|
templates/index.html
CHANGED
@@ -155,7 +155,8 @@
|
|
155 |
<div class="instruction">
|
156 |
Let's get started! Please input your name, enter a random number as your seed, and select two methods for your experiment.
|
157 |
</div>
|
158 |
-
|
|
|
159 |
<label for="username">Hi there πππ ! What is your name?</label>
|
160 |
<input type="text" id="username" name="username" required>
|
161 |
<label for="seed">What is your lucky number? πππ </label>
|
@@ -182,4 +183,4 @@
|
|
182 |
</form>
|
183 |
</div>
|
184 |
</body>
|
185 |
-
</html>
|
|
|
155 |
<div class="instruction">
|
156 |
Let's get started! Please input your name, enter a random number as your seed, and select two methods for your experiment.
|
157 |
</div>
|
158 |
+
<!-- Updated form action -->
|
159 |
+
<form id="method-form" action="{{ url_for('index') }}" method="post" onsubmit="return validateForm();">
|
160 |
<label for="username">Hi there πππ ! What is your name?</label>
|
161 |
<input type="text" id="username" name="username" required>
|
162 |
<label for="seed">What is your lucky number? πππ </label>
|
|
|
183 |
</form>
|
184 |
</div>
|
185 |
</body>
|
186 |
+
</html>
|
templates/introduction.html
ADDED
@@ -0,0 +1,65 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<!DOCTYPE html>
|
2 |
+
<html>
|
3 |
+
<head>
|
4 |
+
<title>Introduction to Table Question Answering</title>
|
5 |
+
<style>
|
6 |
+
/* Include your styles here */
|
7 |
+
body {
|
8 |
+
font-family: 'Roboto', sans-serif;
|
9 |
+
background: url('/static/images/background.jpg') no-repeat center center fixed;
|
10 |
+
background-size: cover;
|
11 |
+
display: flex;
|
12 |
+
justify-content: center;
|
13 |
+
align-items: center;
|
14 |
+
height: 100vh;
|
15 |
+
margin: 0;
|
16 |
+
}
|
17 |
+
.container {
|
18 |
+
text-align: center;
|
19 |
+
background-color: #ffffff;
|
20 |
+
padding: 60px;
|
21 |
+
border-radius: 10px;
|
22 |
+
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
|
23 |
+
width: 60%;
|
24 |
+
}
|
25 |
+
h1 {
|
26 |
+
color: #000000;
|
27 |
+
font-size: 48px;
|
28 |
+
margin-bottom: 30px;
|
29 |
+
}
|
30 |
+
p {
|
31 |
+
font-size: 20px;
|
32 |
+
color: #333;
|
33 |
+
margin-bottom: 30px;
|
34 |
+
}
|
35 |
+
button {
|
36 |
+
background-color: #4CAF50;
|
37 |
+
color: white;
|
38 |
+
padding: 15px 30px;
|
39 |
+
border: none;
|
40 |
+
border-radius: 5px;
|
41 |
+
cursor: pointer;
|
42 |
+
font-size: 24px;
|
43 |
+
transition: background-color 0.3s ease;
|
44 |
+
margin-top: 20px;
|
45 |
+
}
|
46 |
+
button:hover {
|
47 |
+
background-color: #45a049;
|
48 |
+
}
|
49 |
+
</style>
|
50 |
+
</head>
|
51 |
+
<body>
|
52 |
+
<div class="container">
|
53 |
+
<h1>Welcome to the Table Question Answering Experiment</h1>
|
54 |
+
<p>
|
55 |
+
In this experiment, you will interact with Table Question Answering (TableQA) systems.
|
56 |
+
TableQA involves answering questions based on data provided in tables, similar to spreadsheets.
|
57 |
+
</p>
|
58 |
+
<p>
|
59 |
+
Your task is to evaluate different methods that explain how the TableQA system arrives at its answers.
|
60 |
+
Understanding these explanations helps improve trust and transparency in AI systems.
|
61 |
+
</p>
|
62 |
+
<button onclick="location.href='{{ url_for('attribution') }}'">Next</button>
|
63 |
+
</div>
|
64 |
+
</body>
|
65 |
+
</html>
|