Spaces:
Build error
Build error
Commit ·
7003a4e
1
Parent(s): 1a7f6aa
update
Browse files67 unmodified lines6869707172737427 unmodified lines10210310410510610710 unmodified lines11811912012112212312467 unmodified linesdef generate_random_string(length=8):return ''.join(random.choices(string.ascii_letters + string.digits, k=length))@app.route('/', methods=['GET', 'POST'])def index():logger.info("Rendering index page.")27 unmodified linessession['responses'] = [] # Initialize responses listsession['method'] = method # Store the selected methodreturn redirect(url_for('experiment', username=username, sample_index=0, seed=seed, filename=filename))except Exception as e:10 unmodified lineswith open(f'session_data/{filename}', 'r') as f:selected_samples = json.load(f)method = session.get('method') # Retrieve the selected methodif sample_index >= len(selected_samples):logger.error(f"Sample index {sample_index} exceeds the number of selected samples {len(selected_samples)}.")67 unmodified lines68697071727327 unmodified lines10110210310410510610710 unmodified lines11811912012112212312412512612767 unmodified linesdef generate_random_string(length=8):return ''.join(random.choices(string.ascii_letters + string.digits, k=length))@app.route('/', methods=['GET', 'POST'])def index():logger.info("Rendering index page.")27 unmodified linessession['responses'] = [] # Initialize responses listsession['method'] = method # Store the selected methodlogger.info(f"Method stored in session: {session['method']}")return redirect(url_for('experiment', username=username, sample_index=0, seed=seed, filename=filename))except Exception as e:10 unmodified lineswith open(f'session_data/{filename}', 'r') as f:selected_samples = json.load(f)method = session.get('method')if not method:logger.error(f"Method not found in session. Session contents: {session.items()}")return "Method not found", 500if sample_index >= len(selected_samples):logger.error(f"Sample index {sample_index} exceeds the number of selected samples {len(selected_samples)}.")
app.py+5-2