Spaces:
Build error
Build error
Commit ·
fafbcc3
1
Parent(s): 83152ea
update
Browse filesFiles changed (10)
- app.logAdded+44
- app.py+11-5
- flask_session/2029240f6d1128be89ddc32729463129
- flask_session/37c06e74d0670b1daa976daa1006f152Added
- flask_session/b3595f335557d641288146d0dad4e6adAdded
- human_study/123_124_Chain-of-Table_tytAHMbn.jsonAdded+9
- session_data/123123_123_Chain-of-Table_vdiIRk4V.jsonAdded+1
- session_data/123_123_Chain-of-Table_vdiIRk4V.jsonAdded+1
- session_data/method_123123.txtAdded+1
- templates/experiment.html+4-14
12345678910111213141516171819202122232425262728293031323334353637383940414243442024-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 * Running on http://127.0.0.1:78602024-08-30 10:06:28,191 - werkzeug - INFO - [33mPress CTRL+C to quit[0m2024-08-30 10:06:30,925 - __main__ - INFO - Rendering index page.2024-08-30 10:06:30,938 - werkzeug - INFO - 127.0.0.1 - - [30/Aug/2024 10:06:30] "GET / HTTP/1.1" 200 -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 -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 -2024-08-30 10:06:54,074 - __main__ - INFO - Rendering index page.2024-08-30 10:06:54,074 - __main__ - INFO - Loading samples for method: Chain-of-Table2024-08-30 10:06:54,076 - __main__ - INFO - Loaded 799 samples for category TP2024-08-30 10:06:54,078 - __main__ - INFO - Loaded 843 samples for category TN2024-08-30 10:06:54,079 - __main__ - INFO - Loaded 177 samples for category FP2024-08-30 10:06:54,081 - __main__ - INFO - Loaded 205 samples for category FN2024-08-30 10:06:54,081 - __main__ - INFO - Selected balanced samples: 102024-08-30 10:06:54,081 - __main__ - INFO - Generated filename: 124124_124124_Chain-of-Table_1FSin9cI.json2024-08-30 10:06:54,086 - werkzeug - INFO - 127.0.0.1 - - [30/Aug/2024 10:06:54] "[32mPOST / HTTP/1.1[0m" 302 -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 -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 -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 -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 * Running on all addresses (0.0.0.0) * Running on http://127.0.0.1:7860 * Running on http://172.19.130.189:78602024-08-30 14:12:04,086 - werkzeug - INFO - [33mPress CTRL+C to quit[0m2024-08-30 14:12:05,734 - __main__ - INFO - Rendering index page.2024-08-30 14:12:05,756 - werkzeug - INFO - 172.19.130.189 - - [30/Aug/2024 14:12:05] "GET / HTTP/1.1" 200 -2024-08-30 14:12:05,760 - __main__ - INFO - Rendering index page.2024-08-30 14:12:05,761 - werkzeug - INFO - 172.19.130.189 - - [30/Aug/2024 14:12:05] "GET / HTTP/1.1" 200 -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 -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 -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 -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 -2024-08-30 14:12:09,272 - __main__ - INFO - Rendering index page.2024-08-30 14:12:09,273 - __main__ - INFO - Loading samples for method: Chain-of-Table2024-08-30 14:12:09,280 - __main__ - INFO - Loaded 799 samples for category TP2024-08-30 14:12:09,286 - __main__ - INFO - Loaded 843 samples for category TN2024-08-30 14:12:09,288 - __main__ - INFO - Loaded 177 samples for category FP2024-08-30 14:12:09,290 - __main__ - INFO - Loaded 205 samples for category FN2024-08-30 14:12:09,290 - __main__ - INFO - Selected balanced samples: 102024-08-30 14:12:09,290 - __main__ - INFO - Number of selected samples: 102024-08-30 14:12:09,290 - __main__ - INFO - Generated filename: 123123_123_Chain-of-Table_vdiIRk4V.json2024-08-30 14:12:09,293 - werkzeug - INFO - 172.19.130.189 - - [30/Aug/2024 14:12:09] "[32mPOST / HTTP/1.1[0m" 302 -2024-08-30 14:12:09,299 - __main__ - INFO - Rendering experiment page with visualization: htmls_COT/TP/test-268.html2024-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 -11234156 unmodified lines16116216316416416516616791 unmodified lines259260261262263264262263264265266267268269270271272273from flask import Flask, render_template, request, redirect, url_for, send_from_directory, sessionfrom flask import Flask, render_template, request, redirect, url_for, send_from_directory, session, safe_joinimport jsonimport randomimport os156 unmodified lines return render_template('experiment.html', sample_id=current_index, statement=statement, visualization=url_for('send_visualization', path=visualization_path), visualization=url_for('send_visualization', filename=visualization_path), username=username) except Exception as e: logger.exception(f"An error occurred in the experiment route: {e}")91 unmodified lines logger.exception(f"An error occurred in the completed route: {e}") return "An error occurred", 500
@app.route('/visualizations/<path:path>')def send_visualization(path): return send_from_directory('.', path)@app.route('/visualizations/<path:filename>')def send_visualization(filename): logger.info(f"Attempting to serve file: {filename}") # Ensure the path is safe and doesn't allow access to files outside the intended directory safe_path = safe_join(os.getcwd(), filename) directory = os.path.dirname(safe_path) file_name = os.path.basename(safe_path) logger.info(f"Serving file from directory: {directory}, filename: {file_name}") return send_from_directory(directory, file_name)
if __name__ == "__main__": os.makedirs('session_data', exist_ok=True) # Ensure the directory for session files exists123456789{ "0": { "Username": "123", "Seed": "124", "Sample ID": "POS_test-0.html", "Task": "Please make a decision to Accept/Reject the AI prediction based on the explanation.", "User Feedback": "TRUE" }}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"]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"]1Chain-of-Table86 unmodified lines878889909091929394939496979899959610210397981051061071089910010110210311410486 unmodified lines <h1>{{ sample_id + 1 }} / 10</h1> <p><strong>Task:</strong> {{ statement }}</p> <div class="visualization-container"> <iframe src="{{ url_for('send_visualization', path=visualization) }}"></iframe> <iframe src="{{ visualization }}"></iframe> </div> <div class="buttons"> <form action="/feedback" method="post" style="width: 48%;"> <input type="hidden" name="sample_id" value="POS_test-{{ sample_id }}.html"> <form action="{{ url_for('feedback') }}" method="post" style="width: 48%;"> <input type="hidden" name="username" value="{{ username }}"> <input type="hidden" name="seed" value="{{ seed }}"> <input type="hidden" name="filename" value="{{ filename }}"> <input type="hidden" name="selected_samples" value="{{ selected_samples }}"> <input type="hidden" name="sample_index" value="{{ sample_index }}"> <button type="submit" name="feedback" value="TRUE">Accept</button> </form> <form action="/feedback" method="post" style="width: 48%;"> <input type="hidden" name="sample_id" value="POS_test-{{ sample_id }}.html"> <form action="{{ url_for('feedback') }}" method="post" style="width: 48%;"> <input type="hidden" name="username" value="{{ username }}"> <input type="hidden" name="seed" value="{{ seed }}"> <input type="hidden" name="filename" value="{{ filename }}"> <input type="hidden" name="selected_samples" value="{{ selected_samples }}"> <input type="hidden" name="sample_index" value="{{ sample_index }}"> <button type="submit" name="feedback" value="FALSE" class="reject">Reject</button> </form> </div> </div></body></html></html>app.logAdded+44
app.py+11-5
flask_session/2029240f6d1128be89ddc32729463129
flask_session/37c06e74d0670b1daa976daa1006f152Added
flask_session/b3595f335557d641288146d0dad4e6adAdded
human_study/123_124_Chain-of-Table_tytAHMbn.jsonAdded+9
session_data/123123_123_Chain-of-Table_vdiIRk4V.jsonAdded+1
session_data/123_123_Chain-of-Table_vdiIRk4V.jsonAdded+1
session_data/method_123123.txtAdded+1
templates/experiment.html+4-14