luulinh90s
commited on
Commit
•
da1da84
1
Parent(s):
0dc341f
update
Browse files
app.py
CHANGED
@@ -89,6 +89,11 @@ def index():
|
|
89 |
random.seed(seed)
|
90 |
all_samples = load_samples(method)
|
91 |
selected_samples = select_balanced_samples(all_samples)
|
|
|
|
|
|
|
|
|
|
|
92 |
random_string = generate_random_string()
|
93 |
filename = f'{username}_{seed}_{method}_{random_string}.json'
|
94 |
|
@@ -104,7 +109,6 @@ def index():
|
|
104 |
return "An error occurred", 500
|
105 |
return render_template('index.html')
|
106 |
|
107 |
-
|
108 |
@app.route('/experiment/<username>/<sample_index>/<seed>/<filename>', methods=['GET'])
|
109 |
def experiment(username, sample_index, seed, filename):
|
110 |
try:
|
|
|
89 |
random.seed(seed)
|
90 |
all_samples = load_samples(method)
|
91 |
selected_samples = select_balanced_samples(all_samples)
|
92 |
+
logger.info(f"Number of selected samples: {len(selected_samples)}") # Log the number of samples
|
93 |
+
if len(selected_samples) == 0:
|
94 |
+
logger.error("No samples were selected.")
|
95 |
+
return "No samples were selected", 500
|
96 |
+
|
97 |
random_string = generate_random_string()
|
98 |
filename = f'{username}_{seed}_{method}_{random_string}.json'
|
99 |
|
|
|
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:
|