luulinh90s
commited on
Commit
•
fafbcc3
1
Parent(s):
83152ea
update
Browse files- app.log +44 -0
- app.py +11 -5
- flask_session/2029240f6d1128be89ddc32729463129 +0 -0
- flask_session/37c06e74d0670b1daa976daa1006f152 +0 -0
- flask_session/b3595f335557d641288146d0dad4e6ad +0 -0
- human_study/123_124_Chain-of-Table_tytAHMbn.json +9 -0
- session_data/123123_123_Chain-of-Table_vdiIRk4V.json +1 -0
- session_data/123_123_Chain-of-Table_vdiIRk4V.json +1 -0
- session_data/method_123123.txt +1 -0
- templates/experiment.html +4 -14
app.log
ADDED
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
2024-08-30 10:06:28,191 - werkzeug - INFO - [31m[1mWARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.[0m
|
2 |
+
* Running on http://127.0.0.1:7860
|
3 |
+
2024-08-30 10:06:28,191 - werkzeug - INFO - [33mPress CTRL+C to quit[0m
|
4 |
+
2024-08-30 10:06:30,925 - __main__ - INFO - Rendering index page.
|
5 |
+
2024-08-30 10:06:30,938 - werkzeug - INFO - 127.0.0.1 - - [30/Aug/2024 10:06:30] "GET / HTTP/1.1" 200 -
|
6 |
+
2024-08-30 10:06:31,184 - werkzeug - INFO - 127.0.0.1 - - [30/Aug/2024 10:06:31] "GET /static/images/background.jpg HTTP/1.1" 200 -
|
7 |
+
2024-08-30 10:06:31,308 - werkzeug - INFO - 127.0.0.1 - - [30/Aug/2024 10:06:31] "[33mGET /favicon.ico HTTP/1.1[0m" 404 -
|
8 |
+
2024-08-30 10:06:54,074 - __main__ - INFO - Rendering index page.
|
9 |
+
2024-08-30 10:06:54,074 - __main__ - INFO - Loading samples for method: Chain-of-Table
|
10 |
+
2024-08-30 10:06:54,076 - __main__ - INFO - Loaded 799 samples for category TP
|
11 |
+
2024-08-30 10:06:54,078 - __main__ - INFO - Loaded 843 samples for category TN
|
12 |
+
2024-08-30 10:06:54,079 - __main__ - INFO - Loaded 177 samples for category FP
|
13 |
+
2024-08-30 10:06:54,081 - __main__ - INFO - Loaded 205 samples for category FN
|
14 |
+
2024-08-30 10:06:54,081 - __main__ - INFO - Selected balanced samples: 10
|
15 |
+
2024-08-30 10:06:54,081 - __main__ - INFO - Generated filename: 124124_124124_Chain-of-Table_1FSin9cI.json
|
16 |
+
2024-08-30 10:06:54,086 - werkzeug - INFO - 127.0.0.1 - - [30/Aug/2024 10:06:54] "[32mPOST / HTTP/1.1[0m" 302 -
|
17 |
+
2024-08-30 10:06:54,104 - werkzeug - INFO - 127.0.0.1 - - [30/Aug/2024 10:06:54] "GET /experiment/124124/0/124124/124124_124124_Chain-of-Table_1FSin9cI.json HTTP/1.1" 200 -
|
18 |
+
2024-08-30 10:06:54,223 - werkzeug - INFO - 127.0.0.1 - - [30/Aug/2024 10:06:54] "[36mGET /static/images/background.jpg HTTP/1.1[0m" 304 -
|
19 |
+
2024-08-30 10:06:54,224 - werkzeug - INFO - 127.0.0.1 - - [30/Aug/2024 10:06:54] "GET /visualizations/FP/test-1209.html HTTP/1.1" 200 -
|
20 |
+
2024-08-30 14:12:04,086 - werkzeug - INFO - [31m[1mWARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.[0m
|
21 |
+
* Running on all addresses (0.0.0.0)
|
22 |
+
* Running on http://127.0.0.1:7860
|
23 |
+
* Running on http://172.19.130.189:7860
|
24 |
+
2024-08-30 14:12:04,086 - werkzeug - INFO - [33mPress CTRL+C to quit[0m
|
25 |
+
2024-08-30 14:12:05,734 - __main__ - INFO - Rendering index page.
|
26 |
+
2024-08-30 14:12:05,756 - werkzeug - INFO - 172.19.130.189 - - [30/Aug/2024 14:12:05] "GET / HTTP/1.1" 200 -
|
27 |
+
2024-08-30 14:12:05,760 - __main__ - INFO - Rendering index page.
|
28 |
+
2024-08-30 14:12:05,761 - werkzeug - INFO - 172.19.130.189 - - [30/Aug/2024 14:12:05] "GET / HTTP/1.1" 200 -
|
29 |
+
2024-08-30 14:12:06,042 - werkzeug - INFO - 172.19.130.189 - - [30/Aug/2024 14:12:06] "GET /static/images/background.jpg HTTP/1.1" 200 -
|
30 |
+
2024-08-30 14:12:06,061 - werkzeug - INFO - 172.19.130.189 - - [30/Aug/2024 14:12:06] "[36mGET /static/images/background.jpg HTTP/1.1[0m" 304 -
|
31 |
+
2024-08-30 14:12:06,315 - werkzeug - INFO - 172.19.130.189 - - [30/Aug/2024 14:12:06] "[33mGET /favicon.ico HTTP/1.1[0m" 404 -
|
32 |
+
2024-08-30 14:12:06,318 - werkzeug - INFO - 172.19.130.189 - - [30/Aug/2024 14:12:06] "[33mGET /favicon.ico HTTP/1.1[0m" 404 -
|
33 |
+
2024-08-30 14:12:09,272 - __main__ - INFO - Rendering index page.
|
34 |
+
2024-08-30 14:12:09,273 - __main__ - INFO - Loading samples for method: Chain-of-Table
|
35 |
+
2024-08-30 14:12:09,280 - __main__ - INFO - Loaded 799 samples for category TP
|
36 |
+
2024-08-30 14:12:09,286 - __main__ - INFO - Loaded 843 samples for category TN
|
37 |
+
2024-08-30 14:12:09,288 - __main__ - INFO - Loaded 177 samples for category FP
|
38 |
+
2024-08-30 14:12:09,290 - __main__ - INFO - Loaded 205 samples for category FN
|
39 |
+
2024-08-30 14:12:09,290 - __main__ - INFO - Selected balanced samples: 10
|
40 |
+
2024-08-30 14:12:09,290 - __main__ - INFO - Number of selected samples: 10
|
41 |
+
2024-08-30 14:12:09,290 - __main__ - INFO - Generated filename: 123123_123_Chain-of-Table_vdiIRk4V.json
|
42 |
+
2024-08-30 14:12:09,293 - werkzeug - INFO - 172.19.130.189 - - [30/Aug/2024 14:12:09] "[32mPOST / HTTP/1.1[0m" 302 -
|
43 |
+
2024-08-30 14:12:09,299 - __main__ - INFO - Rendering experiment page with visualization: htmls_COT/TP/test-268.html
|
44 |
+
2024-08-30 14:12:09,302 - werkzeug - INFO - 172.19.130.189 - - [30/Aug/2024 14:12:09] "GET /experiment/123123/0/123/123123_123_Chain-of-Table_vdiIRk4V.json HTTP/1.1" 200 -
|
app.py
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
from flask import Flask, render_template, request, redirect, url_for, send_from_directory, session
|
2 |
import json
|
3 |
import random
|
4 |
import os
|
@@ -161,7 +161,7 @@ def experiment(username):
|
|
161 |
return render_template('experiment.html',
|
162 |
sample_id=current_index,
|
163 |
statement=statement,
|
164 |
-
visualization=url_for('send_visualization',
|
165 |
username=username)
|
166 |
except Exception as e:
|
167 |
logger.exception(f"An error occurred in the experiment route: {e}")
|
@@ -259,9 +259,15 @@ def completed(username):
|
|
259 |
logger.exception(f"An error occurred in the completed route: {e}")
|
260 |
return "An error occurred", 500
|
261 |
|
262 |
-
@app.route('/visualizations/<path:
|
263 |
-
def send_visualization(
|
264 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
265 |
|
266 |
if __name__ == "__main__":
|
267 |
os.makedirs('session_data', exist_ok=True) # Ensure the directory for session files exists
|
|
|
1 |
+
from flask import Flask, render_template, request, redirect, url_for, send_from_directory, session, safe_join
|
2 |
import json
|
3 |
import random
|
4 |
import os
|
|
|
161 |
return render_template('experiment.html',
|
162 |
sample_id=current_index,
|
163 |
statement=statement,
|
164 |
+
visualization=url_for('send_visualization', filename=visualization_path),
|
165 |
username=username)
|
166 |
except Exception as e:
|
167 |
logger.exception(f"An error occurred in the experiment route: {e}")
|
|
|
259 |
logger.exception(f"An error occurred in the completed route: {e}")
|
260 |
return "An error occurred", 500
|
261 |
|
262 |
+
@app.route('/visualizations/<path:filename>')
|
263 |
+
def send_visualization(filename):
|
264 |
+
logger.info(f"Attempting to serve file: {filename}")
|
265 |
+
# Ensure the path is safe and doesn't allow access to files outside the intended directory
|
266 |
+
safe_path = safe_join(os.getcwd(), filename)
|
267 |
+
directory = os.path.dirname(safe_path)
|
268 |
+
file_name = os.path.basename(safe_path)
|
269 |
+
logger.info(f"Serving file from directory: {directory}, filename: {file_name}")
|
270 |
+
return send_from_directory(directory, file_name)
|
271 |
|
272 |
if __name__ == "__main__":
|
273 |
os.makedirs('session_data', exist_ok=True) # Ensure the directory for session files exists
|
flask_session/2029240f6d1128be89ddc32729463129
CHANGED
Binary files a/flask_session/2029240f6d1128be89ddc32729463129 and b/flask_session/2029240f6d1128be89ddc32729463129 differ
|
|
flask_session/37c06e74d0670b1daa976daa1006f152
ADDED
Binary file (310 Bytes). View file
|
|
flask_session/b3595f335557d641288146d0dad4e6ad
ADDED
Binary file (262 Bytes). View file
|
|
human_study/123_124_Chain-of-Table_tytAHMbn.json
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"0": {
|
3 |
+
"Username": "123",
|
4 |
+
"Seed": "124",
|
5 |
+
"Sample ID": "POS_test-0.html",
|
6 |
+
"Task": "Please make a decision to Accept/Reject the AI prediction based on the explanation.",
|
7 |
+
"User Feedback": "TRUE"
|
8 |
+
}
|
9 |
+
}
|
session_data/123123_123_Chain-of-Table_vdiIRk4V.json
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
["test-268.html", "test-35.html", "test-593.html", "test-1076.html", "test-1303.html", "test-77.html", "test-813.html", "test-550.html", "test-1241.html", "test-1325.html"]
|
session_data/123_123_Chain-of-Table_vdiIRk4V.json
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
["test-647.html", "test-1986.html", "test-1717.html", "test-58.html", "test-954.html", "test-1193.html", "test-810.html", "test-977.html", "test-1792.html", "test-1016.html"]
|
session_data/method_123123.txt
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
Chain-of-Table
|
templates/experiment.html
CHANGED
@@ -87,28 +87,18 @@
|
|
87 |
<h1>{{ sample_id + 1 }} / 10</h1>
|
88 |
<p><strong>Task:</strong> {{ statement }}</p>
|
89 |
<div class="visualization-container">
|
90 |
-
<iframe src="{{
|
91 |
</div>
|
92 |
<div class="buttons">
|
93 |
-
<form action="
|
94 |
-
<input type="hidden" name="sample_id" value="POS_test-{{ sample_id }}.html">
|
95 |
<input type="hidden" name="username" value="{{ username }}">
|
96 |
-
<input type="hidden" name="seed" value="{{ seed }}">
|
97 |
-
<input type="hidden" name="filename" value="{{ filename }}">
|
98 |
-
<input type="hidden" name="selected_samples" value="{{ selected_samples }}">
|
99 |
-
<input type="hidden" name="sample_index" value="{{ sample_index }}">
|
100 |
<button type="submit" name="feedback" value="TRUE">Accept</button>
|
101 |
</form>
|
102 |
-
<form action="
|
103 |
-
<input type="hidden" name="sample_id" value="POS_test-{{ sample_id }}.html">
|
104 |
<input type="hidden" name="username" value="{{ username }}">
|
105 |
-
<input type="hidden" name="seed" value="{{ seed }}">
|
106 |
-
<input type="hidden" name="filename" value="{{ filename }}">
|
107 |
-
<input type="hidden" name="selected_samples" value="{{ selected_samples }}">
|
108 |
-
<input type="hidden" name="sample_index" value="{{ sample_index }}">
|
109 |
<button type="submit" name="feedback" value="FALSE" class="reject">Reject</button>
|
110 |
</form>
|
111 |
</div>
|
112 |
</div>
|
113 |
</body>
|
114 |
-
</html>
|
|
|
87 |
<h1>{{ sample_id + 1 }} / 10</h1>
|
88 |
<p><strong>Task:</strong> {{ statement }}</p>
|
89 |
<div class="visualization-container">
|
90 |
+
<iframe src="{{ visualization }}"></iframe>
|
91 |
</div>
|
92 |
<div class="buttons">
|
93 |
+
<form action="{{ url_for('feedback') }}" method="post" style="width: 48%;">
|
|
|
94 |
<input type="hidden" name="username" value="{{ username }}">
|
|
|
|
|
|
|
|
|
95 |
<button type="submit" name="feedback" value="TRUE">Accept</button>
|
96 |
</form>
|
97 |
+
<form action="{{ url_for('feedback') }}" method="post" style="width: 48%;">
|
|
|
98 |
<input type="hidden" name="username" value="{{ username }}">
|
|
|
|
|
|
|
|
|
99 |
<button type="submit" name="feedback" value="FALSE" class="reject">Reject</button>
|
100 |
</form>
|
101 |
</div>
|
102 |
</div>
|
103 |
</body>
|
104 |
+
</html>
|