Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -3,7 +3,7 @@ import os
|
|
3 |
from groq import Groq
|
4 |
|
5 |
# Set up page configuration
|
6 |
-
st.set_page_config(page_title="EduNexus
|
7 |
|
8 |
# Set the Groq API key
|
9 |
os.environ["GROQ_API_KEY"] = "your_groq_api_key_here" # Replace with your actual API key
|
@@ -61,6 +61,9 @@ if 'responses' not in st.session_state:
|
|
61 |
"mental_health_check_in": ""
|
62 |
}
|
63 |
|
|
|
|
|
|
|
64 |
# Add custom styling using Streamlit
|
65 |
st.markdown("""
|
66 |
<style>
|
@@ -143,50 +146,65 @@ tasks = [
|
|
143 |
selected_task = st.sidebar.radio("Select a task", tasks)
|
144 |
|
145 |
# Main layout based on selected task
|
146 |
-
|
147 |
-
st.
|
148 |
-
|
149 |
-
|
150 |
-
|
|
|
151 |
if submit_button:
|
152 |
-
response =
|
|
|
153 |
st.write(response)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
154 |
|
155 |
elif selected_task == "π€ AI Coding Mentor":
|
156 |
st.header("AI Coding Mentor")
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
|
164 |
elif selected_task == "π Smart Document Summarizer":
|
165 |
st.header("Smart Document Summarizer")
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
|
173 |
elif selected_task == "ποΈ Interactive Study Planner":
|
174 |
st.header("Interactive Study Planner")
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
|
182 |
elif selected_task == "π¬ Real-Time Q&A Support":
|
183 |
st.header("Real-Time Q&A Support")
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
|
191 |
elif selected_task == "π§ Mental Health Check-In":
|
192 |
st.header("Mental Health Check-In")
|
@@ -197,9 +215,12 @@ elif selected_task == "π§ Mental Health Check-In":
|
|
197 |
submit_button = st.form_submit_button("Get Advice")
|
198 |
with col2:
|
199 |
clear_button = st.form_submit_button("Clear")
|
|
|
200 |
if submit_button:
|
201 |
response = mental_health_check_in(feelings)
|
|
|
202 |
st.write(response)
|
|
|
203 |
if clear_button:
|
204 |
st.session_state['responses']['mental_health_check_in'] = ""
|
205 |
st.experimental_rerun()
|
|
|
3 |
from groq import Groq
|
4 |
|
5 |
# Set up page configuration
|
6 |
+
st.set_page_config(page_title="EduNexus", page_icon=":book:", layout="wide")
|
7 |
|
8 |
# Set the Groq API key
|
9 |
os.environ["GROQ_API_KEY"] = "your_groq_api_key_here" # Replace with your actual API key
|
|
|
61 |
"mental_health_check_in": ""
|
62 |
}
|
63 |
|
64 |
+
if 'clear_all' not in st.session_state:
|
65 |
+
st.session_state['clear_all'] = False
|
66 |
+
|
67 |
# Add custom styling using Streamlit
|
68 |
st.markdown("""
|
69 |
<style>
|
|
|
146 |
selected_task = st.sidebar.radio("Select a task", tasks)
|
147 |
|
148 |
# Main layout based on selected task
|
149 |
+
def handle_task_form(task_key, prompt_function, input_label, response_key):
|
150 |
+
with st.form(key=f"{task_key}_form"):
|
151 |
+
user_input = st.text_area(input_label)
|
152 |
+
submit_button = st.form_submit_button("Get Response")
|
153 |
+
clear_button = st.form_submit_button("Clear")
|
154 |
+
|
155 |
if submit_button:
|
156 |
+
response = prompt_function(user_input)
|
157 |
+
st.session_state['responses'][response_key] = response
|
158 |
st.write(response)
|
159 |
+
|
160 |
+
if clear_button:
|
161 |
+
st.session_state['responses'][response_key] = ""
|
162 |
+
st.experimental_rerun()
|
163 |
+
|
164 |
+
if selected_task == "π Personalized Learning Assistant":
|
165 |
+
st.header("Personalized Learning Assistant")
|
166 |
+
handle_task_form(
|
167 |
+
"personalized_learning_assistant",
|
168 |
+
personalized_learning_assistant,
|
169 |
+
"Enter the topic you want to learn about",
|
170 |
+
"personalized_learning_assistant"
|
171 |
+
)
|
172 |
|
173 |
elif selected_task == "π€ AI Coding Mentor":
|
174 |
st.header("AI Coding Mentor")
|
175 |
+
handle_task_form(
|
176 |
+
"ai_coding_mentor",
|
177 |
+
ai_coding_mentor,
|
178 |
+
"Paste your code snippet here",
|
179 |
+
"ai_coding_mentor"
|
180 |
+
)
|
181 |
|
182 |
elif selected_task == "π Smart Document Summarizer":
|
183 |
st.header("Smart Document Summarizer")
|
184 |
+
handle_task_form(
|
185 |
+
"smart_document_summarizer",
|
186 |
+
smart_document_summarizer,
|
187 |
+
"Paste your document text here",
|
188 |
+
"smart_document_summarizer"
|
189 |
+
)
|
190 |
|
191 |
elif selected_task == "ποΈ Interactive Study Planner":
|
192 |
st.header("Interactive Study Planner")
|
193 |
+
handle_task_form(
|
194 |
+
"interactive_study_planner",
|
195 |
+
interactive_study_planner,
|
196 |
+
"Enter your exam schedule here",
|
197 |
+
"interactive_study_planner"
|
198 |
+
)
|
199 |
|
200 |
elif selected_task == "π¬ Real-Time Q&A Support":
|
201 |
st.header("Real-Time Q&A Support")
|
202 |
+
handle_task_form(
|
203 |
+
"real_time_qa_support",
|
204 |
+
real_time_qa_support,
|
205 |
+
"Ask your academic question here",
|
206 |
+
"real_time_qa_support"
|
207 |
+
)
|
208 |
|
209 |
elif selected_task == "π§ Mental Health Check-In":
|
210 |
st.header("Mental Health Check-In")
|
|
|
215 |
submit_button = st.form_submit_button("Get Advice")
|
216 |
with col2:
|
217 |
clear_button = st.form_submit_button("Clear")
|
218 |
+
|
219 |
if submit_button:
|
220 |
response = mental_health_check_in(feelings)
|
221 |
+
st.session_state['responses']['mental_health_check_in'] = response
|
222 |
st.write(response)
|
223 |
+
|
224 |
if clear_button:
|
225 |
st.session_state['responses']['mental_health_check_in'] = ""
|
226 |
st.experimental_rerun()
|