awacke1 commited on
Commit
3e170c5
Β·
verified Β·
1 Parent(s): 4ffd976

Update backup18.app.py

Browse files
Files changed (1) hide show
  1. backup18.app.py +168 -142
backup18.app.py CHANGED
@@ -106,6 +106,10 @@ if 'last_query' not in st.session_state:
106
  if 'marquee_content' not in st.session_state:
107
  st.session_state['marquee_content'] = "πŸš€ Welcome to TalkingAIResearcher | πŸ€– Your Research Assistant"
108
 
 
 
 
 
109
  # API Keys
110
  openai_api_key = os.getenv('OPENAI_API_KEY', "")
111
  anthropic_key = os.getenv('ANTHROPIC_API_KEY_3', "")
@@ -124,7 +128,14 @@ API_URL = os.getenv('API_URL')
124
  FILE_EMOJIS = {
125
  "md": "πŸ“",
126
  "mp3": "🎡",
127
- "wav": "πŸ”Š"
 
 
 
 
 
 
 
128
  }
129
 
130
  # ─────────────────────────────────────────────────────────
@@ -439,35 +450,45 @@ def display_papers_in_sidebar(papers):
439
  st.markdown(f"**Summary:** {paper['summary'][:300]}...")
440
 
441
  # ─────────────────────────────────────────────────────────
442
- # 4. ZIP FUNCTION
443
  # ─────────────────────────────────────────────────────────
444
 
445
- def create_zip_of_files(md_files, mp3_files, wav_files, input_question):
446
  """
447
- Zip up all relevant files, limiting the final zip name to ~20 chars
448
  to avoid overly long base64 strings.
449
  """
450
- md_files = [f for f in md_files if os.path.basename(f).lower() != 'readme.md']
451
- all_files = md_files + mp3_files + wav_files
 
 
 
 
 
 
 
 
452
  if not all_files:
453
  return None
454
 
 
455
  all_content = []
456
  for f in all_files:
457
- if f.endswith('.md'):
458
- with open(f, 'r', encoding='utf-8') as file:
459
- all_content.append(file.read())
460
- elif f.endswith('.mp3') or f.endswith('.wav'):
461
- basename = os.path.splitext(os.path.basename(f))[0]
462
- words = basename.replace('_', ' ')
463
- all_content.append(words)
464
-
465
- all_content.append(input_question)
 
466
  combined_content = " ".join(all_content)
467
  info_terms = get_high_info_terms(combined_content, top_n=10)
468
 
469
  timestamp = format_timestamp_prefix()
470
- name_text = '-'.join(term for term in info_terms[:5])
471
  short_zip_name = (timestamp + "_" + name_text)[:20] + ".zip"
472
 
473
  with zipfile.ZipFile(short_zip_name, 'w') as z:
@@ -475,6 +496,16 @@ def create_zip_of_files(md_files, mp3_files, wav_files, input_question):
475
  z.write(f)
476
  return short_zip_name
477
 
 
 
 
 
 
 
 
 
 
 
478
  # ─────────────────────────────────────────────────────────
479
  # 5. MAIN LOGIC: AI LOOKUP & VOICE INPUT
480
  # ─────────────────────────────────────────────────────────
@@ -483,9 +514,6 @@ def perform_ai_lookup(q, vocal_summary=True, extended_refs=False,
483
  titles_summary=True, full_audio=False):
484
  """Main routine that uses Anthropic (Claude) + Gradio ArXiv RAG pipeline."""
485
  start = time.time()
486
- ai_constitution = """
487
- You are a talented AI coder and songwriter...
488
- """
489
 
490
  # --- 1) Claude API
491
  client = anthropic.Anthropic(api_key=anthropic_key)
@@ -516,7 +544,6 @@ def perform_ai_lookup(q, vocal_summary=True, extended_refs=False,
516
  "mistralai/Mixtral-8x7B-Instruct-v0.1",
517
  api_name="/update_with_rag_md"
518
  )[0]
519
-
520
  r2 = client.predict(
521
  q,
522
  "mistralai/Mixtral-8x7B-Instruct-v0.1",
@@ -572,17 +599,21 @@ def process_voice_input(text):
572
 
573
  def display_file_history_in_sidebar():
574
  """
575
- Shows a history of each local .md, .mp3, .wav file in descending
576
  order of modification time, with quick icons and optional download links.
577
  """
578
  st.sidebar.markdown("---")
579
  st.sidebar.markdown("### πŸ“‚ File History")
580
 
581
- # Gather all files
582
- md_files = glob.glob("*.md")
583
- mp3_files = glob.glob("*.mp3")
584
- wav_files = glob.glob("*.wav")
585
- all_files = md_files + mp3_files + wav_files
 
 
 
 
586
 
587
  if not all_files:
588
  st.sidebar.write("No files found.")
@@ -617,103 +648,93 @@ def display_file_history_in_sidebar():
617
  # ─────────────────────────────────────────────────────────
618
 
619
  def main():
620
- # 1) Setup marquee UI in the sidebar
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
621
  update_marquee_settings_ui()
622
  marquee_settings = get_marquee_settings()
623
 
624
- # 2) Display the marquee welcome
 
 
 
625
  display_marquee(st.session_state['marquee_content'],
626
  {**marquee_settings, "font-size": "28px", "lineHeight": "50px"},
627
  key_suffix="welcome")
628
 
629
- # 3) Main action tabs
630
- tab_main = st.radio("Action:", ["🎀 Voice", "πŸ“Έ Media", "πŸ” ArXiv", "πŸ“ Editor"],
631
- horizontal=True)
632
-
633
- # Example custom component usage
634
- mycomponent = components.declare_component("mycomponent", path="mycomponent")
635
- val = mycomponent(my_input_value="Hello")
636
-
637
- if val:
638
- val_stripped = val.replace('\\n', ' ')
639
- edited_input = st.text_area("✏️ Edit Input:", value=val_stripped, height=100)
640
- run_option = st.selectbox("Model:", ["Arxiv"])
641
- col1, col2 = st.columns(2)
642
- with col1:
643
- autorun = st.checkbox("βš™ AutoRun", value=True)
644
- with col2:
645
- full_audio = st.checkbox("πŸ“šFullAudio", value=False)
646
-
647
- input_changed = (val != st.session_state.old_val)
648
-
649
- if autorun and input_changed:
650
- st.session_state.old_val = val
651
- st.session_state.last_query = edited_input
652
- perform_ai_lookup(edited_input,
653
- vocal_summary=True,
654
- extended_refs=False,
655
- titles_summary=True,
656
- full_audio=full_audio)
657
- else:
658
- if st.button("β–Ά Run"):
659
- st.session_state.old_val = val
660
- st.session_state.last_query = edited_input
661
- perform_ai_lookup(edited_input,
662
- vocal_summary=True,
663
- extended_refs=False,
664
- titles_summary=True,
665
- full_audio=full_audio)
666
-
667
- # ─────────────────���───────────────────────────────────────
668
- # TAB: ArXiv
669
- # ─────────────────────────────────────────────────────────
670
- if tab_main == "πŸ” ArXiv":
671
- st.subheader("πŸ” Query ArXiv")
672
- q = st.text_input("πŸ” Query:", key="arxiv_query")
673
-
674
- st.markdown("### πŸŽ› Options")
675
- vocal_summary = st.checkbox("πŸŽ™ShortAudio", value=True, key="option_vocal_summary")
676
- extended_refs = st.checkbox("πŸ“œLongRefs", value=False, key="option_extended_refs")
677
- titles_summary = st.checkbox("πŸ”–TitlesOnly", value=True, key="option_titles_summary")
678
- full_audio = st.checkbox("πŸ“šFullAudio", value=False, key="option_full_audio")
679
- full_transcript = st.checkbox("🧾FullTranscript", value=False, key="option_full_transcript")
680
-
681
- if q and st.button("πŸ”Run"):
682
- st.session_state.last_query = q
683
- result = perform_ai_lookup(q, vocal_summary=vocal_summary, extended_refs=extended_refs,
684
- titles_summary=titles_summary, full_audio=full_audio)
685
- if full_transcript:
686
- create_file(q, result, "md")
687
 
688
- # ─────────────────────────────────────────────────────────
689
- # TAB: Voice
690
- # ─────────────────────────────────────────────────────────
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
691
  elif tab_main == "🎀 Voice":
692
  st.subheader("🎀 Voice Input")
693
-
694
- st.markdown("### 🎀 Voice Settings")
695
- selected_voice = st.selectbox(
696
- "Select TTS Voice:",
697
- options=EDGE_TTS_VOICES,
698
- index=EDGE_TTS_VOICES.index(st.session_state['tts_voice'])
699
- )
700
-
701
- st.markdown("### πŸ”Š Audio Format")
702
- selected_format = st.radio(
703
- "Choose Audio Format:",
704
- options=["MP3", "WAV"],
705
- index=0
706
- )
707
-
708
- # Update session state if voice/format changes
709
- if selected_voice != st.session_state['tts_voice']:
710
- st.session_state['tts_voice'] = selected_voice
711
- st.rerun()
712
- if selected_format.lower() != st.session_state['audio_format']:
713
- st.session_state['audio_format'] = selected_format.lower()
714
- st.rerun()
715
-
716
- # Input text
717
  user_text = st.text_area("πŸ’¬ Message:", height=100)
718
  user_text = user_text.strip().replace('\n', ' ')
719
 
@@ -725,16 +746,10 @@ def main():
725
  st.write("**You:**", c["user"])
726
  st.write("**Response:**", c["claude"])
727
 
728
- # ─────────────────────────────────────────────────────────
729
- # TAB: Media
730
- # ─────────────────────────────────────────────────────────
731
  elif tab_main == "πŸ“Έ Media":
732
  st.header("πŸ“Έ Media Gallery")
733
-
734
- # By default, show audio first
735
  tabs = st.tabs(["🎡 Audio", "πŸ–Ό Images", "πŸŽ₯ Video"])
736
-
737
- # AUDIO sub-tab
738
  with tabs[0]:
739
  st.subheader("🎡 Audio Files")
740
  audio_files = glob.glob("*.mp3") + glob.glob("*.wav")
@@ -747,8 +762,6 @@ def main():
747
  st.markdown(dl_link, unsafe_allow_html=True)
748
  else:
749
  st.write("No audio files found.")
750
-
751
- # IMAGES sub-tab
752
  with tabs[1]:
753
  st.subheader("πŸ–Ό Image Files")
754
  imgs = glob.glob("*.png") + glob.glob("*.jpg") + glob.glob("*.jpeg")
@@ -760,8 +773,6 @@ def main():
760
  st.image(Image.open(f), use_container_width=True)
761
  else:
762
  st.write("No images found.")
763
-
764
- # VIDEO sub-tab
765
  with tabs[2]:
766
  st.subheader("πŸŽ₯ Video Files")
767
  vids = glob.glob("*.mp4") + glob.glob("*.mov") + glob.glob("*.avi")
@@ -772,30 +783,45 @@ def main():
772
  else:
773
  st.write("No videos found.")
774
 
775
- # ─────────────────────────────────────────────────────────
776
- # TAB: Editor
777
- # ─────────────────────────────────────────────────────────
778
- elif tab_main == "πŸ“ Editor":
779
- st.write("Select or create a file to edit. (Currently minimal demo)")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
780
 
781
- # ─────────────────────────────────────────────────────────
782
- # SIDEBAR: FILE HISTORY
783
- # ─────────────────────────────────────────────────────────
784
- display_file_history_in_sidebar()
 
 
 
 
 
785
 
786
- # Some light CSS styling
787
- st.markdown("""
788
- <style>
789
- .main { background: linear-gradient(to right, #1a1a1a, #2d2d2d); color: #fff; }
790
- .stMarkdown { font-family: 'Helvetica Neue', sans-serif; }
791
- .stButton>button { margin-right: 0.5rem; }
792
- </style>
793
- """, unsafe_allow_html=True)
794
 
795
  # Rerun if needed
796
  if st.session_state.should_rerun:
797
  st.session_state.should_rerun = False
798
- st.rerun()
799
 
800
  if __name__ == "__main__":
801
  main()
 
106
  if 'marquee_content' not in st.session_state:
107
  st.session_state['marquee_content'] = "πŸš€ Welcome to TalkingAIResearcher | πŸ€– Your Research Assistant"
108
 
109
+ # New: default AutoRun to False (off)
110
+ if 'autorun' not in st.session_state:
111
+ st.session_state['autorun'] = False
112
+
113
  # API Keys
114
  openai_api_key = os.getenv('OPENAI_API_KEY', "")
115
  anthropic_key = os.getenv('ANTHROPIC_API_KEY_3', "")
 
128
  FILE_EMOJIS = {
129
  "md": "πŸ“",
130
  "mp3": "🎡",
131
+ "wav": "πŸ”Š",
132
+ "pdf": "πŸ“•",
133
+ "mp4": "πŸŽ₯",
134
+ "csv": "πŸ“ˆ",
135
+ "xlsx": "πŸ“Š",
136
+ "html": "🌐",
137
+ "py": "🐍",
138
+ "txt": "πŸ“„"
139
  }
140
 
141
  # ─────────────────────────────────────────────────────────
 
450
  st.markdown(f"**Summary:** {paper['summary'][:300]}...")
451
 
452
  # ─────────────────────────────────────────────────────────
453
+ # 4. ZIP & DELETE-ALL UTILS
454
  # ─────────────────────────────────────────────────────────
455
 
456
+ def create_zip_of_all_files():
457
  """
458
+ Zip up all recognized file types, limiting the final zip name to ~20 chars
459
  to avoid overly long base64 strings.
460
  """
461
+ # Patterns for .md, .pdf, .mp4, .mp3, .wav, .csv, .xlsx, .html, .py, .txt
462
+ file_patterns = [
463
+ "*.md", "*.pdf", "*.mp4", "*.mp3", "*.wav",
464
+ "*.csv", "*.xlsx", "*.html", "*.py", "*.txt"
465
+ ]
466
+ all_files = []
467
+ for pat in file_patterns:
468
+ all_files.extend(glob.glob(pat))
469
+ all_files = list(set(all_files)) # unique
470
+
471
  if not all_files:
472
  return None
473
 
474
+ # Combine content for naming
475
  all_content = []
476
  for f in all_files:
477
+ if f.endswith(".md"):
478
+ with open(f, "r", encoding="utf-8") as fin:
479
+ all_content.append(fin.read())
480
+ else:
481
+ all_content.append(os.path.basename(f))
482
+
483
+ # Add last query if relevant
484
+ if st.session_state['last_query']:
485
+ all_content.append(st.session_state['last_query'])
486
+
487
  combined_content = " ".join(all_content)
488
  info_terms = get_high_info_terms(combined_content, top_n=10)
489
 
490
  timestamp = format_timestamp_prefix()
491
+ name_text = '-'.join(term for term in info_terms[:5])
492
  short_zip_name = (timestamp + "_" + name_text)[:20] + ".zip"
493
 
494
  with zipfile.ZipFile(short_zip_name, 'w') as z:
 
496
  z.write(f)
497
  return short_zip_name
498
 
499
+ def delete_all_files():
500
+ """Removes all recognized file types from the directory."""
501
+ file_patterns = [
502
+ "*.md", "*.pdf", "*.mp4", "*.mp3", "*.wav",
503
+ "*.csv", "*.xlsx", "*.html", "*.py", "*.txt"
504
+ ]
505
+ for pat in file_patterns:
506
+ for f in glob.glob(pat):
507
+ os.remove(f)
508
+
509
  # ─────────────────────────────────────────────────────────
510
  # 5. MAIN LOGIC: AI LOOKUP & VOICE INPUT
511
  # ─────────────────────────────────────────────────────────
 
514
  titles_summary=True, full_audio=False):
515
  """Main routine that uses Anthropic (Claude) + Gradio ArXiv RAG pipeline."""
516
  start = time.time()
 
 
 
517
 
518
  # --- 1) Claude API
519
  client = anthropic.Anthropic(api_key=anthropic_key)
 
544
  "mistralai/Mixtral-8x7B-Instruct-v0.1",
545
  api_name="/update_with_rag_md"
546
  )[0]
 
547
  r2 = client.predict(
548
  q,
549
  "mistralai/Mixtral-8x7B-Instruct-v0.1",
 
599
 
600
  def display_file_history_in_sidebar():
601
  """
602
+ Shows a history of each recognized file in descending
603
  order of modification time, with quick icons and optional download links.
604
  """
605
  st.sidebar.markdown("---")
606
  st.sidebar.markdown("### πŸ“‚ File History")
607
 
608
+ # Patterns for .md, .mp3, .wav, .pdf, .mp4, .csv, .xlsx, .html, .py, .txt
609
+ patterns = [
610
+ "*.md", "*.pdf", "*.mp4", "*.mp3", "*.wav",
611
+ "*.csv", "*.xlsx", "*.html", "*.py", "*.txt"
612
+ ]
613
+ all_files = []
614
+ for p in patterns:
615
+ all_files.extend(glob.glob(p))
616
+ all_files = list(set(all_files)) # unique
617
 
618
  if not all_files:
619
  st.sidebar.write("No files found.")
 
648
  # ─────────────────────────────────────────────────────────
649
 
650
  def main():
651
+ """
652
+ Main Streamlit app.
653
+ Now includes:
654
+ 1) Voice & AutoRun at the top of the sidebar,
655
+ 2) File Tools (Delete All / Zip All) in the sidebar,
656
+ 3) A new 'πŸ“€ Upload' tab,
657
+ 4) Everything else from your original code snippet.
658
+ """
659
+
660
+ # -- 1) Voice & AutoRun at top of sidebar --
661
+ st.sidebar.title("Global Settings")
662
+ selected_voice = st.sidebar.selectbox(
663
+ "TTS Voice",
664
+ options=EDGE_TTS_VOICES,
665
+ index=EDGE_TTS_VOICES.index(st.session_state['tts_voice'])
666
+ )
667
+ # Autorun defaults to off (False)
668
+ st.session_state.autorun = st.sidebar.checkbox("AutoRun", value=st.session_state.autorun)
669
+
670
+ # Audio format
671
+ audio_format = st.sidebar.radio("Audio Format", ["MP3","WAV"], index=0)
672
+ if selected_voice != st.session_state['tts_voice']:
673
+ st.session_state['tts_voice'] = selected_voice
674
+ st.experimental_rerun()
675
+ if audio_format.lower() != st.session_state['audio_format']:
676
+ st.session_state['audio_format'] = audio_format.lower()
677
+ st.experimental_rerun()
678
+
679
+ # -- 2) File Tools: Delete All / Zip All
680
+ st.sidebar.markdown("---")
681
+ st.sidebar.markdown("### πŸ—ƒ File Tools")
682
+ col_del, col_zip = st.sidebar.columns(2)
683
+ with col_del:
684
+ if st.button("πŸ—‘ Delete All"):
685
+ delete_all_files()
686
+ st.sidebar.success("All recognized files removed!")
687
+ st.experimental_rerun()
688
+ with col_zip:
689
+ if st.button("πŸ“¦ Zip All"):
690
+ zip_name = create_zip_of_all_files()
691
+ if zip_name:
692
+ st.sidebar.markdown(get_download_link(zip_name, "zip"), unsafe_allow_html=True)
693
+
694
+ # -- 3) Marquee Settings
695
  update_marquee_settings_ui()
696
  marquee_settings = get_marquee_settings()
697
 
698
+ # -- 4) File History in sidebar
699
+ display_file_history_in_sidebar()
700
+
701
+ # -- 5) Display marquee
702
  display_marquee(st.session_state['marquee_content'],
703
  {**marquee_settings, "font-size": "28px", "lineHeight": "50px"},
704
  key_suffix="welcome")
705
 
706
+ # -- 6) Main action tabs
707
+ tab_main = st.radio(
708
+ "Action:",
709
+ ["πŸ“€ Upload", "🎀 Voice", "πŸ“Έ Media", "πŸ” ArXiv", "πŸ“ Editor"],
710
+ horizontal=True
711
+ )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
712
 
713
+ # 6a) Upload Tab
714
+ if tab_main == "πŸ“€ Upload":
715
+ st.header("πŸ“€ Upload Files")
716
+ accepted_types = [
717
+ # We'll accept basically everything (None in file_uploader),
718
+ # but let's specify for clarity:
719
+ "text/plain", "text/markdown", "audio/mpeg", "audio/wav",
720
+ "image/png", "image/jpeg", "video/mp4", "application/pdf",
721
+ "application/vnd.ms-excel",
722
+ "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
723
+ "text/html", "application/octet-stream",
724
+ ]
725
+ uploaded = st.file_uploader("Select files to upload:",
726
+ accept_multiple_files=True,
727
+ type=None)
728
+ if uploaded:
729
+ for uf in uploaded:
730
+ with open(uf.name, "wb") as outfile:
731
+ outfile.write(uf.read())
732
+ st.success("Uploaded!")
733
+ st.session_state.should_rerun = True
734
+
735
+ # 6b) Voice Tab
736
  elif tab_main == "🎀 Voice":
737
  st.subheader("🎀 Voice Input")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
738
  user_text = st.text_area("πŸ’¬ Message:", height=100)
739
  user_text = user_text.strip().replace('\n', ' ')
740
 
 
746
  st.write("**You:**", c["user"])
747
  st.write("**Response:**", c["claude"])
748
 
749
+ # 6c) Media Tab
 
 
750
  elif tab_main == "πŸ“Έ Media":
751
  st.header("πŸ“Έ Media Gallery")
 
 
752
  tabs = st.tabs(["🎡 Audio", "πŸ–Ό Images", "πŸŽ₯ Video"])
 
 
753
  with tabs[0]:
754
  st.subheader("🎡 Audio Files")
755
  audio_files = glob.glob("*.mp3") + glob.glob("*.wav")
 
762
  st.markdown(dl_link, unsafe_allow_html=True)
763
  else:
764
  st.write("No audio files found.")
 
 
765
  with tabs[1]:
766
  st.subheader("πŸ–Ό Image Files")
767
  imgs = glob.glob("*.png") + glob.glob("*.jpg") + glob.glob("*.jpeg")
 
773
  st.image(Image.open(f), use_container_width=True)
774
  else:
775
  st.write("No images found.")
 
 
776
  with tabs[2]:
777
  st.subheader("πŸŽ₯ Video Files")
778
  vids = glob.glob("*.mp4") + glob.glob("*.mov") + glob.glob("*.avi")
 
783
  else:
784
  st.write("No videos found.")
785
 
786
+ # 6d) ArXiv Tab
787
+ elif tab_main == "πŸ” ArXiv":
788
+ st.subheader("πŸ” Query ArXiv")
789
+ q = st.text_input("πŸ” Query:", key="arxiv_query")
790
+
791
+ st.markdown("### πŸŽ› Options")
792
+ st.write("(AutoRun is in the sidebar.)")
793
+ extended_refs = st.checkbox("πŸ“œLongRefs", value=False, key="option_extended_refs")
794
+ titles_summary = st.checkbox("πŸ”–TitlesOnly", value=True, key="option_titles_summary")
795
+ full_audio = st.checkbox("πŸ“šFullAudio", value=False, key="option_full_audio")
796
+ full_transcript = st.checkbox("🧾FullTranscript", value=False, key="option_full_transcript")
797
+
798
+ if q and st.button("πŸ”Run"):
799
+ st.session_state.last_query = q
800
+ result = perform_ai_lookup(q,
801
+ extended_refs=extended_refs,
802
+ titles_summary=titles_summary,
803
+ full_audio=full_audio)
804
+ if full_transcript:
805
+ create_file(q, result, "md")
806
 
807
+ # If AutoRun is ON and user typed something
808
+ if st.session_state.autorun and q:
809
+ st.session_state.last_query = q
810
+ result = perform_ai_lookup(q,
811
+ extended_refs=extended_refs,
812
+ titles_summary=titles_summary,
813
+ full_audio=full_audio)
814
+ if full_transcript:
815
+ create_file(q, result, "md")
816
 
817
+ # 6e) Editor Tab
818
+ elif tab_main == "πŸ“ Editor":
819
+ st.write("Select or create a file to edit. (Currently minimal demo)")
 
 
 
 
 
820
 
821
  # Rerun if needed
822
  if st.session_state.should_rerun:
823
  st.session_state.should_rerun = False
824
+ st.experimental_rerun()
825
 
826
  if __name__ == "__main__":
827
  main()