VyLala commited on
Commit
64d0b74
·
verified ·
1 Parent(s): 37e04a2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -14
app.py CHANGED
@@ -474,6 +474,7 @@ with gr.Blocks() as interface:
474
  email_tracked = False
475
  log_lines = []
476
  usage_text = ""
 
477
  if not email.strip():
478
  output_file_path = None#"Write your email so that you can download the outputs."
479
  log_lines.append("📥 Provide your email to receive a downloadable Excel report and get 20 more free queries.")
@@ -496,7 +497,7 @@ with gr.Blocks() as interface:
496
  gr.update(visible=True), # 9 reset_button
497
  gr.update(visible=True), # 10 raw_text
498
  gr.update(visible=True), # 11 file_upload
499
- gr.update(value="", visible=False), # 12 processed_info
500
  gr.update(visible=False) # 13 nps_modal
501
  )
502
 
@@ -521,6 +522,14 @@ with gr.Blocks() as interface:
521
 
522
  # Step 1: Parse input
523
  accessions, error = extract_accessions_from_input(file, text)
 
 
 
 
 
 
 
 
524
  ### NEW: Hide inputs, show processed_info at start
525
  yield (
526
  make_html_table(all_rows), # output_table
@@ -534,7 +543,7 @@ with gr.Blocks() as interface:
534
  gr.update(visible=True), # show reset button
535
  gr.update(visible=False), # hide raw_text
536
  gr.update(visible=False), # hide file_upload
537
- gr.update(value=f"Processed/Input accessions: {', '.join(accessions)}", visible=True), # processed_info
538
  gr.update(visible=False) # hide NPS modal at start
539
  )
540
 
@@ -558,14 +567,6 @@ with gr.Blocks() as interface:
558
  gr.update(visible=False) # 13 nps_modal
559
  )
560
  return
561
-
562
-
563
- total = len(accessions)
564
- if total > limited_acc:
565
- accessions = accessions[:limited_acc]
566
- warning = f"⚠️ Only processing first {limited_acc} accessions."
567
- else:
568
- warning = f"✅ All {total} accessions will be processed."
569
 
570
  # all_rows = []
571
  # processed_accessions = 0 # ✅ track successful accessions
@@ -637,7 +638,7 @@ with gr.Blocks() as interface:
637
  gr.update(visible=True), # reset_button
638
  gr.update(visible=False), # raw_text
639
  gr.update(visible=False), # file_upload
640
- gr.update(value="", visible=False), # processed_info
641
  gr.update(visible=True) # NPS modal now visible
642
  )
643
 
@@ -665,7 +666,7 @@ with gr.Blocks() as interface:
665
  gr.update(visible=True), # reset_button
666
  gr.update(visible=False), # hide raw_text
667
  gr.update(visible=False), # hide file_upload
668
- gr.update(value=f"Processed/Input accessions: {', '.join(accessions)}", visible=True), # processed_info
669
  gr.update(visible=False) # hide NPS modal at start
670
  )
671
 
@@ -703,7 +704,7 @@ with gr.Blocks() as interface:
703
  gr.update(visible=True), # reset_button
704
  gr.update(visible=False), # raw_text
705
  gr.update(visible=False), # file_upload
706
- gr.update(value=f"Processed/Input accessions: {', '.join(accessions)}", visible=True), # processed_info
707
  gr.update(visible=False) # hide NPS modal
708
  )
709
 
@@ -777,7 +778,7 @@ with gr.Blocks() as interface:
777
  gr.update(visible=True), # reset_button
778
  gr.update(visible=False), # hide raw_text
779
  gr.update(visible=False), # hide file_upload
780
- gr.update(value=f"Processed/Input accessions: {', '.join(accessions)}", visible=True), # processed_info
781
  gr.update(visible=False) # hide NPS modal at start
782
  )
783
 
 
474
  email_tracked = False
475
  log_lines = []
476
  usage_text = ""
477
+ processed_info = ""
478
  if not email.strip():
479
  output_file_path = None#"Write your email so that you can download the outputs."
480
  log_lines.append("📥 Provide your email to receive a downloadable Excel report and get 20 more free queries.")
 
497
  gr.update(visible=True), # 9 reset_button
498
  gr.update(visible=True), # 10 raw_text
499
  gr.update(visible=True), # 11 file_upload
500
+ gr.update(value=processed_info, visible=False), # 12 processed_info
501
  gr.update(visible=False) # 13 nps_modal
502
  )
503
 
 
522
 
523
  # Step 1: Parse input
524
  accessions, error = extract_accessions_from_input(file, text)
525
+ total = len(accessions)
526
+ print("total len original accessions: ", total)
527
+ if total > limited_acc:
528
+ accessions = accessions[:limited_acc]
529
+ warning = f"⚠️ Only processing first {limited_acc} accessions."
530
+ else:
531
+ warning = f"✅ All {total} accessions will be processed."
532
+ processed_info = warning + "\n" +f"Processed/Input accessions: {', '.join(accessions)}"
533
  ### NEW: Hide inputs, show processed_info at start
534
  yield (
535
  make_html_table(all_rows), # output_table
 
543
  gr.update(visible=True), # show reset button
544
  gr.update(visible=False), # hide raw_text
545
  gr.update(visible=False), # hide file_upload
546
+ gr.update(value=processed_info, visible=True), # processed_info
547
  gr.update(visible=False) # hide NPS modal at start
548
  )
549
 
 
567
  gr.update(visible=False) # 13 nps_modal
568
  )
569
  return
 
 
 
 
 
 
 
 
570
 
571
  # all_rows = []
572
  # processed_accessions = 0 # ✅ track successful accessions
 
638
  gr.update(visible=True), # reset_button
639
  gr.update(visible=False), # raw_text
640
  gr.update(visible=False), # file_upload
641
+ gr.update(value=processed_info, visible=False), # processed_info
642
  gr.update(visible=True) # NPS modal now visible
643
  )
644
 
 
666
  gr.update(visible=True), # reset_button
667
  gr.update(visible=False), # hide raw_text
668
  gr.update(visible=False), # hide file_upload
669
+ gr.update(value=processed_info, visible=True), # processed_info
670
  gr.update(visible=False) # hide NPS modal at start
671
  )
672
 
 
704
  gr.update(visible=True), # reset_button
705
  gr.update(visible=False), # raw_text
706
  gr.update(visible=False), # file_upload
707
+ gr.update(value=processed_info, visible=True), # processed_info
708
  gr.update(visible=False) # hide NPS modal
709
  )
710
 
 
778
  gr.update(visible=True), # reset_button
779
  gr.update(visible=False), # hide raw_text
780
  gr.update(visible=False), # hide file_upload
781
+ gr.update(value=processed_info, visible=True), # processed_info
782
  gr.update(visible=False) # hide NPS modal at start
783
  )
784