awacke1 commited on
Commit
bf7933c
Β·
verified Β·
1 Parent(s): 10ef0da

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +71 -88
app.py CHANGED
@@ -582,91 +582,7 @@ def display_file_manager():
582
  st.rerun()
583
 
584
 
585
- def main():
586
- st.sidebar.markdown("### 🚲BikeAIπŸ† Claude and GPT Multi-Agent Research AI")
587
-
588
- # Main navigation
589
- tab_main = st.radio("Choose Action:",
590
- ["πŸ’¬ Chat", "πŸ“Έ Media Gallery", "πŸ” Search ArXiv", "πŸ“ File Editor"],
591
- horizontal=True)
592
-
593
- if tab_main == "πŸ’¬ Chat":
594
- # Model Selection
595
- model_choice = st.sidebar.radio(
596
- "Choose AI Model:",
597
- ["GPT-4o", "Claude-3", "GPT+Claude+Arxiv"]
598
- )
599
-
600
- # Chat Interface
601
- user_input = st.text_area("Message:", height=100)
602
-
603
- if st.button("Send πŸ“¨"):
604
- if user_input:
605
- if model_choice == "GPT-4o":
606
- gpt_response = process_with_gpt(user_input)
607
- elif model_choice == "Claude-3":
608
- claude_response = process_with_claude(user_input)
609
- else: # Both
610
- col1, col2, col3 = st.columns(3)
611
- with col2:
612
- st.subheader("Claude-3.5 Sonnet:")
613
- try:
614
- claude_response = process_with_claude(user_input)
615
- except:
616
- st.write('Claude 3.5 Sonnet out of tokens.')
617
- with col1:
618
- st.subheader("GPT-4o Omni:")
619
- try:
620
- gpt_response = process_with_gpt(user_input)
621
- except:
622
- st.write('GPT 4o out of tokens')
623
- with col3:
624
- st.subheader("Arxiv and Mistral Research:")
625
- with st.spinner("Searching ArXiv..."):
626
- #results = search_arxiv(user_input)
627
- results = perform_ai_lookup(user_input)
628
-
629
- st.markdown(results)
630
-
631
- # Display Chat History
632
- st.subheader("Chat History πŸ“œ")
633
- tab1, tab2 = st.tabs(["Claude History", "GPT-4o History"])
634
-
635
- with tab1:
636
- for chat in st.session_state.chat_history:
637
- st.text_area("You:", chat["user"], height=100)
638
- st.text_area("Claude:", chat["claude"], height=200)
639
- st.markdown(chat["claude"])
640
-
641
- with tab2:
642
- for message in st.session_state.messages:
643
- with st.chat_message(message["role"]):
644
- st.markdown(message["content"])
645
-
646
- elif tab_main == "πŸ“Έ Media Gallery":
647
- create_media_gallery()
648
-
649
- elif tab_main == "πŸ” Search ArXiv":
650
- query = st.text_input("Enter your research query:")
651
- if query:
652
- with st.spinner("Searching ArXiv..."):
653
- results = search_arxiv(query)
654
- st.markdown(results)
655
-
656
- elif tab_main == "πŸ“ File Editor":
657
- if hasattr(st.session_state, 'current_file'):
658
- st.subheader(f"Editing: {st.session_state.current_file}")
659
- new_content = st.text_area("Content:", st.session_state.file_content, height=300)
660
- if st.button("Save Changes"):
661
- with open(st.session_state.current_file, 'w', encoding='utf-8') as file:
662
- file.write(new_content)
663
- st.success("File updated successfully!")
664
-
665
- # Always show file manager in sidebar
666
- display_file_manager()
667
 
668
- if __name__ == "__main__":
669
- main()
670
 
671
  # Speech Recognition HTML Component
672
  speech_recognition_html = """
@@ -950,6 +866,22 @@ def get_media_html(media_path, media_type="video", width="100%"):
950
  Your browser does not support the audio element.
951
  </audio>
952
  '''
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
953
 
954
  def main():
955
  st.sidebar.markdown("### 🚲BikeAIπŸ† Claude and GPT Multi-Agent Research AI")
@@ -1008,10 +940,59 @@ def main():
1008
  if st.session_state.last_voice_input:
1009
  st.text_area("Last Voice Input:", st.session_state.last_voice_input, height=100)
1010
 
1011
- # [Rest of the main function remains the same]
1012
- elif tab_main == "πŸ’¬ Chat":
1013
- # [Previous chat interface code]
1014
- pass
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1015
 
1016
  elif tab_main == "πŸ“Έ Media Gallery":
1017
  create_media_gallery()
@@ -1031,6 +1012,8 @@ def main():
1031
  with open(st.session_state.current_file, 'w', encoding='utf-8') as file:
1032
  file.write(new_content)
1033
  st.success("File updated successfully!")
 
 
1034
 
1035
  # Always show file manager in sidebar
1036
  display_file_manager()
 
582
  st.rerun()
583
 
584
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
585
 
 
 
586
 
587
  # Speech Recognition HTML Component
588
  speech_recognition_html = """
 
866
  Your browser does not support the audio element.
867
  </audio>
868
  '''
869
+
870
+
871
+ def main_old():
872
+
873
+ # Main navigation
874
+ tab_main = st.radio("Choose Action:",
875
+ ["πŸ’¬ Chat", "πŸ“Έ Media Gallery", "πŸ” Search ArXiv", "πŸ“ File Editor"],
876
+ horizontal=True)
877
+
878
+ # Always show file manager in sidebar
879
+ # display_file_manager()
880
+
881
+ #if __name__ == "__main__":
882
+ # main()
883
+
884
+
885
 
886
  def main():
887
  st.sidebar.markdown("### 🚲BikeAIπŸ† Claude and GPT Multi-Agent Research AI")
 
940
  if st.session_state.last_voice_input:
941
  st.text_area("Last Voice Input:", st.session_state.last_voice_input, height=100)
942
 
943
+
944
+ if tab_main == "πŸ’¬ Chat":
945
+ # Model Selection
946
+ model_choice = st.sidebar.radio(
947
+ "Choose AI Model:",
948
+ ["GPT-4o", "Claude-3", "GPT+Claude+Arxiv"]
949
+ )
950
+
951
+ # Chat Interface
952
+ user_input = st.text_area("Message:", height=100)
953
+
954
+ if st.button("Send πŸ“¨"):
955
+ if user_input:
956
+ if model_choice == "GPT-4o":
957
+ gpt_response = process_with_gpt(user_input)
958
+ elif model_choice == "Claude-3":
959
+ claude_response = process_with_claude(user_input)
960
+ else: # Both
961
+ col1, col2, col3 = st.columns(3)
962
+ with col2:
963
+ st.subheader("Claude-3.5 Sonnet:")
964
+ try:
965
+ claude_response = process_with_claude(user_input)
966
+ except:
967
+ st.write('Claude 3.5 Sonnet out of tokens.')
968
+ with col1:
969
+ st.subheader("GPT-4o Omni:")
970
+ try:
971
+ gpt_response = process_with_gpt(user_input)
972
+ except:
973
+ st.write('GPT 4o out of tokens')
974
+ with col3:
975
+ st.subheader("Arxiv and Mistral Research:")
976
+ with st.spinner("Searching ArXiv..."):
977
+ #results = search_arxiv(user_input)
978
+ results = perform_ai_lookup(user_input)
979
+
980
+ st.markdown(results)
981
+
982
+ # Display Chat History
983
+ st.subheader("Chat History πŸ“œ")
984
+ tab1, tab2 = st.tabs(["Claude History", "GPT-4o History"])
985
+
986
+ with tab1:
987
+ for chat in st.session_state.chat_history:
988
+ st.text_area("You:", chat["user"], height=100)
989
+ st.text_area("Claude:", chat["claude"], height=200)
990
+ st.markdown(chat["claude"])
991
+
992
+ with tab2:
993
+ for message in st.session_state.messages:
994
+ with st.chat_message(message["role"]):
995
+ st.markdown(message["content"])
996
 
997
  elif tab_main == "πŸ“Έ Media Gallery":
998
  create_media_gallery()
 
1012
  with open(st.session_state.current_file, 'w', encoding='utf-8') as file:
1013
  file.write(new_content)
1014
  st.success("File updated successfully!")
1015
+
1016
+
1017
 
1018
  # Always show file manager in sidebar
1019
  display_file_manager()