mostafa-sh commited on
Commit
f0f4c54
·
1 Parent(s): 6369dd5

add toggle for expert model with info note

Browse files
Files changed (2) hide show
  1. app.py +25 -6
  2. utils/help.py +10 -1
app.py CHANGED
@@ -54,13 +54,30 @@ adapter_path = HOME + "/LLaMA-TOMMI-1.0/"
54
  base_model_path = "meta-llama/Llama-3.2-11B-Vision-Instruct"
55
  base_model_path_3B = "meta-llama/Llama-3.2-3B-Instruct"
56
 
57
- st.title(":red[AI University] :gray[/] FEM")
58
- # st.markdown("### Finite Element Method")
59
- st.markdown("Welcome to :red[AI University]—an AI-powered platform designed to address scientific course queries, dynamically adapting to instructors' teaching styles and students' learning needs. This prototype demonstrates the capabilities of the AI University platform by providing expert answers to queries related to a graduate-level :red[Finite Element Method (FEM)] course")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
60
 
61
  st.markdown(" ")
62
  st.markdown(" ")
63
  # st.divider()
 
64
  # Sidebar for settings
65
  with st.sidebar:
66
  st.header("Settings")
@@ -111,8 +128,10 @@ with st.sidebar:
111
 
112
  st.write(' ')
113
  with st.expander('Expert model', expanded=False):
114
- use_expert_answer = st.toggle("Use expert answer", value=True)
115
- show_expert_responce = st.toggle("Show initial expert answer", value=False)
 
 
116
 
117
  st.session_state.expert_model = st.selectbox(
118
  "Choose the LLM model",
@@ -285,7 +304,7 @@ if submit_button_placeholder.button("AI Answer", type="primary"):
285
  #-------------------------
286
  # getting expert answer
287
  #-------------------------
288
- if use_expert_answer:
289
  if st.session_state.expert_model in ["LLaMA-TOMMI-1.0-11B", "LLaMA-3.2-11B"]:
290
 
291
  if st.session_state.expert_model == "LLaMA-TOMMI-1.0-11B":
 
54
  base_model_path = "meta-llama/Llama-3.2-11B-Vision-Instruct"
55
  base_model_path_3B = "meta-llama/Llama-3.2-3B-Instruct"
56
 
57
+ # ---------------------------------------
58
+ # ---------------------------------------
59
+
60
+ st.markdown("""
61
+ Welcome to <span style='color:red'><a href='https://my-ai-university.com/' target='_blank' style='text-decoration: none; color: red;'>AI University</a></span> — an AI-powered platform designed to address scientific course queries, dynamically adapting to instructors' teaching styles and students' learning needs.
62
+ This prototype showcases the capabilities of the <span style='color:red'><a href='https://github.com/my-ai-university' target='_blank' style='text-decoration: none; color: red;'>AI University platform</a></span> by providing expert answers to queries related to a graduate-level <span style='color:red'><a href='https://www.youtube.com/playlist?list=PLJhG_d-Sp_JHKVRhfTgDqbic_4MHpltXZ' target='_blank' style='text-decoration: none; color: red;'>Finite Element Method (FEM)</a></span> course.
63
+ """, unsafe_allow_html=True)
64
+
65
+ st.markdown(" ")
66
+ with st.container(border=False):
67
+
68
+ st.info("""
69
+ Heavy traffic or GPU limits may increase response time or cause errors. Disable expert model for faster replies or try again later.
70
+ """, icon="📌")
71
+
72
+ if 'activate_expert' in st.session_state:
73
+ st.session_state.activate_expert = st.toggle("Use expert model", value=st.session_state.activate_expert, key="use_expert_model1")
74
+ else:
75
+ st.session_state.activate_expert = st.toggle("Use expert model", value=True, key="use_expert_model1", help='More accurate but slower')
76
 
77
  st.markdown(" ")
78
  st.markdown(" ")
79
  # st.divider()
80
+
81
  # Sidebar for settings
82
  with st.sidebar:
83
  st.header("Settings")
 
128
 
129
  st.write(' ')
130
  with st.expander('Expert model', expanded=False):
131
+ if st.session_state.activate_expert:
132
+ st.session_state.activate_expert = st.toggle("Use expert model", value=True)
133
+ else:
134
+ st.session_state.activate_expert = st.toggle("Use expert model", value=False)
135
 
136
  st.session_state.expert_model = st.selectbox(
137
  "Choose the LLM model",
 
304
  #-------------------------
305
  # getting expert answer
306
  #-------------------------
307
+ if st.session_state.activate_expert:
308
  if st.session_state.expert_model in ["LLaMA-TOMMI-1.0-11B", "LLaMA-3.2-11B"]:
309
 
310
  if st.session_state.expert_model == "LLaMA-TOMMI-1.0-11B":
utils/help.py CHANGED
@@ -1,7 +1,16 @@
1
 
2
  def get_disclaimer():
3
  return """
4
- :gray[**Main Data Sources:**] [Introduction to Finite Element Methods (FEM) by Prof. Krishna Garikipati](https://www.youtube.com/playlist?list=PLJhG_d-Sp_JHKVRhfTgDqbic_4MHpltXZ) :gray[and] [The Finite Element Method: Linear Static and Dynamic Finite Element Analysis by Thomas J. R. Hughes](https://www.google.com/books/edition/_/cHH2n_qBK0IC?hl=en).
 
 
 
 
 
 
 
 
 
5
 
6
  :gray[**Disclaimer and Copyright Notice:**] :gray[1. AI-Generated Responses: Answers are generated using AI and, while thorough, may not always be 100% accurate. Please verify the information independently. 2. Content Ownership: All video content and lecture material referenced belong to their original creators. We encourage users to view the original material on verified platforms to ensure authenticity and accuracy. 3. Educational Fair Use: This tool is intended solely for educational purposes and operates under the principles of fair use. It is not authorized for commercial applications.]
7
  """
 
1
 
2
  def get_disclaimer():
3
  return """
4
+ :gray[**Resources:**]
5
+ [AI University](https://my-ai-university.com/),
6
+ &nbsp; [ArXiv]() (*coming soon*),
7
+ &nbsp; [GitHub](https://github.com/my-ai-university/finite-element-method),
8
+ &nbsp; [HuggingFace](https://huggingface.co/my-ai-university),
9
+ &nbsp; [WandB](https://wandb.ai/my-ai-university/finite-element-method)
10
+
11
+ :gray[**Main Data Sources:**]
12
+ [Introduction to Finite Element Methods (FEM) by Prof. Krishna Garikipati](https://www.youtube.com/playlist?list=PLJhG_d-Sp_JHKVRhfTgDqbic_4MHpltXZ),
13
+ &nbsp; [The Finite Element Method: Linear Static and Dynamic Finite Element Analysis by Thomas J. R. Hughes](https://www.google.com/books/edition/_/cHH2n_qBK0IC?hl=en).
14
 
15
  :gray[**Disclaimer and Copyright Notice:**] :gray[1. AI-Generated Responses: Answers are generated using AI and, while thorough, may not always be 100% accurate. Please verify the information independently. 2. Content Ownership: All video content and lecture material referenced belong to their original creators. We encourage users to view the original material on verified platforms to ensure authenticity and accuracy. 3. Educational Fair Use: This tool is intended solely for educational purposes and operates under the principles of fair use. It is not authorized for commercial applications.]
16
  """