Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -197,6 +197,8 @@ with gr.Blocks() as interface:
|
|
197 |
warning = f"β
All {total} accessions will be processed."
|
198 |
|
199 |
all_rows = []
|
|
|
|
|
200 |
log_lines = []
|
201 |
|
202 |
# Step 2: Loop through accessions
|
@@ -204,13 +206,14 @@ with gr.Blocks() as interface:
|
|
204 |
if global_stop_flag.value:
|
205 |
log_lines.append(f"π Stopped at {acc} ({i+1}/{total})")
|
206 |
usage_text = ""
|
207 |
-
if email.strip():
|
208 |
# user_hash = hash_user_id(email)
|
209 |
# usage_count = increment_usage(user_hash, len(all_rows))
|
210 |
-
usage_count = increment_usage(email,
|
|
|
211 |
usage_text = f"**{usage_count}** samples used by this email. Ten more samples are added first (you now have 60 limited accessions), then wait we will contact you via this email."
|
212 |
else:
|
213 |
-
usage_text = f"The limited accession is 50. The user has used {
|
214 |
yield (
|
215 |
make_html_table(all_rows),
|
216 |
gr.update(visible=True),
|
@@ -235,6 +238,7 @@ with gr.Blocks() as interface:
|
|
235 |
print(acc)
|
236 |
rows = summarize_results(acc)
|
237 |
all_rows.extend(rows)
|
|
|
238 |
save_to_excel(all_rows, "", "", output_file_path, is_resume=False)
|
239 |
log_lines.append(f"β
Processed {acc} ({i+1}/{total})")
|
240 |
except Exception as e:
|
@@ -251,13 +255,13 @@ with gr.Blocks() as interface:
|
|
251 |
|
252 |
# Final update
|
253 |
usage_text = ""
|
254 |
-
if email.strip():
|
255 |
# user_hash = hash_user_id(email)
|
256 |
# usage_count = increment_usage(user_hash, len(all_rows))
|
257 |
-
usage_count = increment_usage(email,
|
258 |
usage_text = f"**{usage_count}** samples used by this email. Ten more samples are added first (you now have 60 limited accessions), then wait we will contact you via this email."
|
259 |
-
|
260 |
-
usage_text = f"The limited accession is 50. The user has used {
|
261 |
yield (
|
262 |
make_html_table(all_rows),
|
263 |
gr.update(visible=True),
|
|
|
197 |
warning = f"β
All {total} accessions will be processed."
|
198 |
|
199 |
all_rows = []
|
200 |
+
processed_accessions = 0 # β
tracks how many accessions were processed
|
201 |
+
email_tracked = False
|
202 |
log_lines = []
|
203 |
|
204 |
# Step 2: Loop through accessions
|
|
|
206 |
if global_stop_flag.value:
|
207 |
log_lines.append(f"π Stopped at {acc} ({i+1}/{total})")
|
208 |
usage_text = ""
|
209 |
+
if email.strip() and not email_tracked:
|
210 |
# user_hash = hash_user_id(email)
|
211 |
# usage_count = increment_usage(user_hash, len(all_rows))
|
212 |
+
usage_count = increment_usage(email, processed_accessions)
|
213 |
+
email_tracked = True
|
214 |
usage_text = f"**{usage_count}** samples used by this email. Ten more samples are added first (you now have 60 limited accessions), then wait we will contact you via this email."
|
215 |
else:
|
216 |
+
usage_text = f"The limited accession is 50. The user has used {processed_accessions}, and only {50-processed_accessions} left."
|
217 |
yield (
|
218 |
make_html_table(all_rows),
|
219 |
gr.update(visible=True),
|
|
|
238 |
print(acc)
|
239 |
rows = summarize_results(acc)
|
240 |
all_rows.extend(rows)
|
241 |
+
processed_accessions += 1 # β
count only successful accessions
|
242 |
save_to_excel(all_rows, "", "", output_file_path, is_resume=False)
|
243 |
log_lines.append(f"β
Processed {acc} ({i+1}/{total})")
|
244 |
except Exception as e:
|
|
|
255 |
|
256 |
# Final update
|
257 |
usage_text = ""
|
258 |
+
if email.strip() and not email_tracked:
|
259 |
# user_hash = hash_user_id(email)
|
260 |
# usage_count = increment_usage(user_hash, len(all_rows))
|
261 |
+
usage_count = increment_usage(email, processed_accessions)
|
262 |
usage_text = f"**{usage_count}** samples used by this email. Ten more samples are added first (you now have 60 limited accessions), then wait we will contact you via this email."
|
263 |
+
elif not email.strip():
|
264 |
+
usage_text = f"The limited accession is 50. The user has used {processed_accessions}, and only {50-processed_accessions} left."
|
265 |
yield (
|
266 |
make_html_table(all_rows),
|
267 |
gr.update(visible=True),
|