Spaces:
Build error
Build error
Commit ·
24cbc9a
1
Parent(s): 5d30bf1
update
Browse files3 unmodified lines456789148 unmodified lines15815916016116216316416516628 unmodified lines19519619719819920016 unmodified lines2172182192202212222233 unmodified linesimport osimport stringimport logging# Set up logginglogging.basicConfig(level=logging.INFO,148 unmodified lines# statement = "Please make a decision to Accept/Reject the AI prediction based on the explanation."statement = """The Table Question Answering model is working on Table Fact Verification task (TabFact dataset), verifying if a given Statement is TRUE or FALSE on a given input Table.You are given an explanation that describes the reasoning process of the Table Question Answering model in HTML format.Please carefully analyze the explanation and determine you should Accept or Reject the AI prediction."""return render_template('experiment.html',28 unmodified lines# Save updated session datasave_session_data(username, session_data)if session_data['current_index'] >= len(session_data['selected_samples']):return redirect(url_for('completed', username=username))16 unmodified linesif method == "Chain-of-Table":json_file = 'Tabular_LLMs_human_study_vis_6_COT.json'else: # Default to Plan-of-SQLsjson_file = 'Tabular_LLMs_human_study_vis_6.json'with open(json_file, 'r') as f:ground_truth = json.load(f)3 unmodified lines45678910148 unmodified lines15916016116216316416516616728 unmodified lines19619719819920020120220320420520620720820921021121221321421521621721821922022122216 unmodified lines2392402412422432442453 unmodified linesimport osimport stringimport loggingfrom datetime import datetime# Set up logginglogging.basicConfig(level=logging.INFO,148 unmodified lines# statement = "Please make a decision to Accept/Reject the AI prediction based on the explanation."statement = """A Table Question Answering model is working on Table Fact Verification task (TabFact dataset), verifying if a given Statement is TRUE or FALSE on a given input Table.You are given an explanation that describes the reasoning process of the Table QA model.Please carefully analyze the explanation and determine whether you should Accept or Reject the AI prediction."""return render_template('experiment.html',28 unmodified lines# Save updated session datasave_session_data(username, session_data)# Write feedback to a separate JSON fileos.makedirs('session_data', exist_ok=True)feedback_file = f'session_data/{username}_feedback.json'if os.path.exists(feedback_file):with open(feedback_file, 'r') as f:feedback_data = json.load(f)else:feedback_data = []feedback_data.append({'sample_id': session_data['current_index'] - 1,'feedback': feedback,'timestamp': datetime.now().isoformat()})with open(feedback_file, 'w') as f:json.dump(feedback_data, f, indent=4)logger.info(f"Feedback saved for user {username}, sample {session_data['current_index'] - 1}")if session_data['current_index'] >= len(session_data['selected_samples']):return redirect(url_for('completed', username=username))16 unmodified linesif method == "Chain-of-Table":json_file = 'Tabular_LLMs_human_study_vis_6_COT.json'else: # Default to Plan-of-SQLsjson_file = 'Tabular_LLMs_human_study_vis_6_POS.json'with open(json_file, 'r') as f:ground_truth = json.load(f)
app.py+26-4