ibrahim313 commited on
Commit
a96770a
·
verified ·
1 Parent(s): 894d502

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +23 -5
app.py CHANGED
@@ -9,7 +9,7 @@ os.environ["GROQ_API_KEY"] = "gsk_BYXg06vIXpWdFjwDMLnFWGdyb3FYjlovjvzUzo5jtu5A1I
9
  client = Groq(api_key=os.environ.get("GROQ_API_KEY"))
10
 
11
  # Define the LLaMA model to be used
12
- MODEL_NAME = "llama3-groq-70b-8192-tool-use-preview"
13
 
14
  # Function to call Groq API
15
  def call_groq_api(prompt):
@@ -72,6 +72,17 @@ def mental_health_check_in(feelings):
72
  prompt = f"Here are some examples of mental health advice:\n\n{examples}\n\nProvide advice based on the following feeling:\n{feelings}. Offer practical suggestions for improving well-being."
73
  return call_groq_api(prompt)
74
 
 
 
 
 
 
 
 
 
 
 
 
75
  # Define Streamlit app
76
  st.set_page_config(page_title="EduNexus", page_icon=":book:", layout="wide")
77
 
@@ -121,7 +132,14 @@ def clear_chat():
121
  st.session_state['interactive_study_planner'] = ""
122
  st.session_state['real_time_qa_support'] = ""
123
  st.session_state['mental_health_check_in'] = ""
124
- st.session_state['responses'] = {"personalized_learning_assistant": "", "ai_coding_mentor": "", "smart_document_summarizer": "", "interactive_study_planner": "", "real_time_qa_support": "", "mental_health_check_in": ""}
 
 
 
 
 
 
 
125
 
126
  # Add Clear Chat button
127
  if st.sidebar.button("Clear All", key="clear_button"):
@@ -162,8 +180,8 @@ elif selected_tool == "AI Coding Mentor":
162
 
163
  elif selected_tool == "Smart Document Summarizer":
164
  st.header("Smart Document Summarizer")
165
- with st.form(key="summarizer_form"):
166
- document_input = st.text_area("Enter the text you want to summarize", placeholder="Paste document text here...")
167
  submit_button = st.form_submit_button("Summarize Document")
168
  if submit_button:
169
  summary = smart_document_summarizer(document_input)
@@ -173,7 +191,7 @@ elif selected_tool == "Smart Document Summarizer":
173
 
174
  elif selected_tool == "Interactive Study Planner":
175
  st.header("Interactive Study Planner")
176
- with st.form(key="planner_form"):
177
  exam_schedule_input = st.text_area("Enter your exam schedule", placeholder="e.g., 3 exams in one week")
178
  submit_button = st.form_submit_button("Generate Study Plan")
179
  if submit_button:
 
9
  client = Groq(api_key=os.environ.get("GROQ_API_KEY"))
10
 
11
  # Define the LLaMA model to be used
12
+ MODEL_NAME = "llama3-8b-8192"
13
 
14
  # Function to call Groq API
15
  def call_groq_api(prompt):
 
72
  prompt = f"Here are some examples of mental health advice:\n\n{examples}\n\nProvide advice based on the following feeling:\n{feelings}. Offer practical suggestions for improving well-being."
73
  return call_groq_api(prompt)
74
 
75
+ # Initialize session state if not already set
76
+ if 'responses' not in st.session_state:
77
+ st.session_state['responses'] = {
78
+ "personalized_learning_assistant": "",
79
+ "ai_coding_mentor": "",
80
+ "smart_document_summarizer": "",
81
+ "interactive_study_planner": "",
82
+ "real_time_qa_support": "",
83
+ "mental_health_check_in": ""
84
+ }
85
+
86
  # Define Streamlit app
87
  st.set_page_config(page_title="EduNexus", page_icon=":book:", layout="wide")
88
 
 
132
  st.session_state['interactive_study_planner'] = ""
133
  st.session_state['real_time_qa_support'] = ""
134
  st.session_state['mental_health_check_in'] = ""
135
+ st.session_state['responses'] = {
136
+ "personalized_learning_assistant": "",
137
+ "ai_coding_mentor": "",
138
+ "smart_document_summarizer": "",
139
+ "interactive_study_planner": "",
140
+ "real_time_qa_support": "",
141
+ "mental_health_check_in": ""
142
+ }
143
 
144
  # Add Clear Chat button
145
  if st.sidebar.button("Clear All", key="clear_button"):
 
180
 
181
  elif selected_tool == "Smart Document Summarizer":
182
  st.header("Smart Document Summarizer")
183
+ with st.form(key="document_form"):
184
+ document_input = st.text_area("Enter your document text", placeholder="Paste your document text here")
185
  submit_button = st.form_submit_button("Summarize Document")
186
  if submit_button:
187
  summary = smart_document_summarizer(document_input)
 
191
 
192
  elif selected_tool == "Interactive Study Planner":
193
  st.header("Interactive Study Planner")
194
+ with st.form(key="study_form"):
195
  exam_schedule_input = st.text_area("Enter your exam schedule", placeholder="e.g., 3 exams in one week")
196
  submit_button = st.form_submit_button("Generate Study Plan")
197
  if submit_button: