Spaces:
Build error
Build error
Commit
·
51ed47e
1
Parent(s):
64921b6
update
Browse files
app.py
CHANGED
|
@@ -108,7 +108,6 @@ def index():
|
|
| 108 |
logger.exception(f"Error in index route: {e}")
|
| 109 |
return "An error occurred", 500
|
| 110 |
return render_template('index.html')
|
| 111 |
-
|
| 112 |
@app.route('/experiment/<username>/<sample_index>/<seed>/<filename>', methods=['GET'])
|
| 113 |
def experiment(username, sample_index, seed, filename):
|
| 114 |
try:
|
|
@@ -116,8 +115,8 @@ def experiment(username, sample_index, seed, filename):
|
|
| 116 |
selected_samples = session.get('selected_samples', [])
|
| 117 |
method = session.get('method') # Retrieve the selected method
|
| 118 |
|
| 119 |
-
# breakpoint()
|
| 120 |
if sample_index >= len(selected_samples):
|
|
|
|
| 121 |
return redirect(url_for('completed', filename=filename))
|
| 122 |
|
| 123 |
visualization_file = selected_samples[sample_index]
|
|
@@ -136,9 +135,11 @@ def experiment(username, sample_index, seed, filename):
|
|
| 136 |
break
|
| 137 |
|
| 138 |
if not visualization_path:
|
| 139 |
-
logger.error("Visualization file not found.")
|
| 140 |
return "Visualization file not found", 404
|
| 141 |
|
|
|
|
|
|
|
| 142 |
statement = "Please make a decision to Accept/Reject the AI prediction based on the explanation."
|
| 143 |
return render_template('experiment.html',
|
| 144 |
sample_id=sample_index,
|
|
|
|
| 108 |
logger.exception(f"Error in index route: {e}")
|
| 109 |
return "An error occurred", 500
|
| 110 |
return render_template('index.html')
|
|
|
|
| 111 |
@app.route('/experiment/<username>/<sample_index>/<seed>/<filename>', methods=['GET'])
|
| 112 |
def experiment(username, sample_index, seed, filename):
|
| 113 |
try:
|
|
|
|
| 115 |
selected_samples = session.get('selected_samples', [])
|
| 116 |
method = session.get('method') # Retrieve the selected method
|
| 117 |
|
|
|
|
| 118 |
if sample_index >= len(selected_samples):
|
| 119 |
+
logger.error("Sample index exceeds the number of selected samples.")
|
| 120 |
return redirect(url_for('completed', filename=filename))
|
| 121 |
|
| 122 |
visualization_file = selected_samples[sample_index]
|
|
|
|
| 135 |
break
|
| 136 |
|
| 137 |
if not visualization_path:
|
| 138 |
+
logger.error(f"Visualization file {visualization_file} not found in any category.")
|
| 139 |
return "Visualization file not found", 404
|
| 140 |
|
| 141 |
+
logger.info(f"Rendering experiment page with visualization: {visualization_path}")
|
| 142 |
+
|
| 143 |
statement = "Please make a decision to Accept/Reject the AI prediction based on the explanation."
|
| 144 |
return render_template('experiment.html',
|
| 145 |
sample_id=sample_index,
|