Spaces:
Build error
Build error
Commit ·
f7f3eab
1
Parent(s): 19201aa
update
Browse filesFiles changed (3)
- app.py+19-1
- templates/index.html+1-1
- templates/subjective.html+2-9
223 unmodified lines22422522622722822915 unmodified lines245246247248249250251223 unmodified lineslogger.exception(f"An error occurred in the experiment route: {e}")return "An error occurred", 500@app.route('/feedback', methods=['POST'])def feedback():try:15 unmodified lineslogger.info(f"Prediction saved for session {session_id}, sample {session_data['current_index'] - 1}")if session_data['current_index'] >= len(session_data['selected_samples']):return redirect(url_for('completed', session_id=session_id))return redirect(url_for('experiment', session_id=session_id))except Exception as e:223 unmodified lines22422522622722822923023123223323423523623723823924024124224324424524624715 unmodified lines263264265266267268269223 unmodified lineslogger.exception(f"An error occurred in the experiment route: {e}")return "An error occurred", 500@app.route('/subjective/<session_id>', methods=['GET', 'POST'])def subjective(session_id):if request.method == 'POST':understanding = request.form.get('understanding')session_data = load_session_data(session_id)if not session_data:logger.error(f"No session data found for session: {session_id}")return redirect(url_for('index'))session_data['subjective_feedback'] = understandingsave_session_data(session_id, session_data, is_update=True)return redirect(url_for('completed', session_id=session_id))return render_template('subjective.html', session_id=session_id)@app.route('/feedback', methods=['POST'])def feedback():try:15 unmodified lineslogger.info(f"Prediction saved for session {session_id}, sample {session_data['current_index'] - 1}")if session_data['current_index'] >= len(session_data['selected_samples']):return redirect(url_for('subjective', session_id=session_id))return redirect(url_for('experiment', session_id=session_id))except Exception as e:
132 unmodified lines133134135136137138139132 unmodified lines</head><body><div class="container"><h1>Let's get started! Please input your name, a random number, and select one of the 4 explanation methods for your experiment.</h1><!-- <div class="instruction">--><!-- Let's get started! Please input your name, enter a random number as your seed, and select one of the explanation methods for your experiment.--><!-- </div>-->132 unmodified lines133134135136137138139132 unmodified lines</head><body><div class="container"><h1>Let's get started! Please input your name, a random number, and select one of the below explanation methods for your experiment.</h1><!-- <div class="instruction">--><!-- Let's get started! Please input your name, enter a random number as your seed, and select one of the explanation methods for your experiment.--><!-- </div>-->
51 unmodified lines5253545556575823 unmodified lines8283848586878889909192939451 unmodified lines<body><h1>Feedback on Table QA Explanations</h1><form id="feedbackForm"><div class="question"><p>After using the explanations, how much do you think they helped you understand the reasoning process of the Table QA model?</p><div class="likert">23 unmodified lines<button type="submit">Submit Feedback</button></form><script>document.getElementById('feedbackForm').addEventListener('submit', function(e) {e.preventDefault();var selectedValue = document.querySelector('input[name="understanding"]:checked').value;alert('Thank you for your feedback! You selected: ' + selectedValue);// Here you can add code to send this data to your server});</script></body></html>51 unmodified lines5253545556575823 unmodified lines82838485868751 unmodified lines<body><h1>Feedback on Table QA Explanations</h1><form id="feedbackForm" action="{{ url_for('subjective', session_id=session_id) }}" method="post"><div class="question"><p>After using the explanations, how much do you think they helped you understand the reasoning process of the Table QA model?</p><div class="likert">23 unmodified lines<button type="submit">Submit Feedback</button></form><!-- Remove the JavaScript event listener as we're now submitting to the server --></body></html>
app.py+19-1
templates/index.html+1-1
templates/subjective.html+2-9