luulinh90s
commited on
Commit
·
ea1f759
1
Parent(s):
2694be6
update
Browse files- app.py +4 -4
- templates/index.html +0 -1
app.py
CHANGED
@@ -152,14 +152,14 @@ def index():
|
|
152 |
seed = request.form.get('seed')
|
153 |
method = request.form.get('method')
|
154 |
if not username or not seed or not method:
|
155 |
-
return render_template('index.html', error="Please fill in all fields and select a method."
|
156 |
try:
|
157 |
seed = int(seed)
|
158 |
random.seed(seed)
|
159 |
all_samples = load_samples()
|
160 |
selected_samples = select_balanced_samples(all_samples)
|
161 |
if len(selected_samples) == 0:
|
162 |
-
return render_template('index.html', error="No common samples were found"
|
163 |
start_time = datetime.now().isoformat()
|
164 |
session_id = generate_session_id()
|
165 |
session_data = {
|
@@ -182,8 +182,8 @@ def index():
|
|
182 |
return redirect(url_for('explanation', session_id=session_id))
|
183 |
except Exception as e:
|
184 |
logger.exception(f"Error in index route: {e}")
|
185 |
-
return render_template('index.html', error="An error occurred. Please try again."
|
186 |
-
return render_template('index.html'
|
187 |
|
188 |
@app.route('/explanation/<session_id>')
|
189 |
def explanation(session_id):
|
|
|
152 |
seed = request.form.get('seed')
|
153 |
method = request.form.get('method')
|
154 |
if not username or not seed or not method:
|
155 |
+
return render_template('index.html', error="Please fill in all fields and select a method.")
|
156 |
try:
|
157 |
seed = int(seed)
|
158 |
random.seed(seed)
|
159 |
all_samples = load_samples()
|
160 |
selected_samples = select_balanced_samples(all_samples)
|
161 |
if len(selected_samples) == 0:
|
162 |
+
return render_template('index.html', error="No common samples were found")
|
163 |
start_time = datetime.now().isoformat()
|
164 |
session_id = generate_session_id()
|
165 |
session_data = {
|
|
|
182 |
return redirect(url_for('explanation', session_id=session_id))
|
183 |
except Exception as e:
|
184 |
logger.exception(f"Error in index route: {e}")
|
185 |
+
return render_template('index.html', error="An error occurred. Please try again.")
|
186 |
+
return render_template('index.html')
|
187 |
|
188 |
@app.route('/explanation/<session_id>')
|
189 |
def explanation(session_id):
|
templates/index.html
CHANGED
@@ -208,7 +208,6 @@
|
|
208 |
<div class="method-button Dater" onclick="selectMethod('Dater')">
|
209 |
Dater
|
210 |
</div>
|
211 |
-
{% if show_no_xai %}
|
212 |
<div class="method-button No-XAI" onclick="selectMethod('No-XAI')">
|
213 |
No-XAI
|
214 |
</div>
|
|
|
208 |
<div class="method-button Dater" onclick="selectMethod('Dater')">
|
209 |
Dater
|
210 |
</div>
|
|
|
211 |
<div class="method-button No-XAI" onclick="selectMethod('No-XAI')">
|
212 |
No-XAI
|
213 |
</div>
|