Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -65,19 +65,16 @@ st.set_page_config(page_title="EduNexus", page_icon=":book:", layout="wide")
|
|
| 65 |
st.markdown("""
|
| 66 |
<style>
|
| 67 |
body {
|
| 68 |
-
background-color: #
|
| 69 |
-
color: #
|
| 70 |
}
|
| 71 |
.css-1o7k8tt {
|
| 72 |
-
background-color: #
|
| 73 |
-
color: #ffffff;
|
| 74 |
-
}
|
| 75 |
-
.css-1o7k8tt h1 {
|
| 76 |
-
color: #d6a4a0;
|
| 77 |
}
|
| 78 |
.stButton {
|
| 79 |
-
background-color: #
|
| 80 |
-
color: #
|
| 81 |
border-radius: 12px;
|
| 82 |
padding: 12px 24px;
|
| 83 |
font-size: 16px;
|
|
@@ -85,43 +82,43 @@ st.markdown("""
|
|
| 85 |
transition: background-color 0.3s, box-shadow 0.3s;
|
| 86 |
}
|
| 87 |
.stButton:hover {
|
| 88 |
-
background-color: #
|
| 89 |
box-shadow: 0 8px 16px rgba(0, 0, 0, 0.5);
|
| 90 |
}
|
| 91 |
.stTextInput, .stTextArea {
|
| 92 |
-
border: 1px solid #
|
| 93 |
border-radius: 12px;
|
| 94 |
-
background-color: #
|
| 95 |
-
color: #ffffff;
|
| 96 |
}
|
| 97 |
.stTextInput::placeholder, .stTextArea::placeholder {
|
| 98 |
-
color: #a0a0a0;
|
| 99 |
}
|
| 100 |
.stSidebar {
|
| 101 |
-
background-color: #
|
|
|
|
| 102 |
}
|
| 103 |
.stSidebar .stMarkdown {
|
| 104 |
-
color: #ffffff;
|
| 105 |
}
|
| 106 |
.footer {
|
| 107 |
-
background-color: #
|
| 108 |
padding: 15px;
|
| 109 |
text-align: center;
|
| 110 |
-
color: #ffffff;
|
| 111 |
-
border-top: 1px solid #
|
| 112 |
position: fixed;
|
| 113 |
bottom: 0;
|
| 114 |
width: 100%;
|
| 115 |
-
box-shadow: 0 -6px 12px rgba(0, 0, 0, 0.4);
|
| 116 |
}
|
| 117 |
.footer a {
|
| 118 |
-
color: #
|
| 119 |
margin: 0 15px;
|
| 120 |
text-decoration: none;
|
| 121 |
font-size: 18px;
|
| 122 |
}
|
| 123 |
.footer a:hover {
|
| 124 |
-
color: #
|
| 125 |
}
|
| 126 |
.footer i {
|
| 127 |
font-size: 22px;
|
|
@@ -129,72 +126,73 @@ st.markdown("""
|
|
| 129 |
</style>
|
| 130 |
""", unsafe_allow_html=True)
|
| 131 |
|
| 132 |
-
#
|
| 133 |
-
|
| 134 |
-
|
| 135 |
-
|
| 136 |
-
|
| 137 |
-
|
| 138 |
-
|
| 139 |
-
|
| 140 |
-
|
| 141 |
-
|
| 142 |
-
|
| 143 |
-
|
| 144 |
-
|
| 145 |
-
|
| 146 |
-
|
| 147 |
-
|
| 148 |
-
|
| 149 |
-
|
| 150 |
-
|
| 151 |
-
file_name=f"{response_key}.txt"
|
| 152 |
-
)
|
| 153 |
-
with col2:
|
| 154 |
-
if st.button("Clear", key=f"clear_{response_key}"):
|
| 155 |
-
st.session_state['responses'][response_key] = "" # Clear the response for the specific tool
|
| 156 |
-
|
| 157 |
-
# Initialize layout for form
|
| 158 |
-
def display_tool_form(tool_key, submit_function, placeholder):
|
| 159 |
-
with st.form(key=f"{tool_key}_form"):
|
| 160 |
-
input_text = st.text_area(f"Enter your {tool_key.replace('_', ' ')}", placeholder=placeholder)
|
| 161 |
-
col1, col2 = st.columns([3, 1])
|
| 162 |
-
with col1:
|
| 163 |
-
submit_button = st.form_submit_button("Get Explanation")
|
| 164 |
-
with col2:
|
| 165 |
-
clear_button = st.form_submit_button("Clear")
|
| 166 |
if submit_button:
|
| 167 |
-
response =
|
| 168 |
-
st.
|
| 169 |
-
|
| 170 |
-
|
| 171 |
-
|
| 172 |
-
st.
|
| 173 |
-
|
| 174 |
-
|
| 175 |
-
|
| 176 |
-
|
| 177 |
-
|
| 178 |
-
|
| 179 |
-
|
| 180 |
-
|
| 181 |
-
st.
|
| 182 |
-
|
| 183 |
-
|
| 184 |
-
|
| 185 |
-
|
| 186 |
-
|
| 187 |
-
|
| 188 |
-
|
| 189 |
-
|
| 190 |
-
st.
|
| 191 |
-
|
| 192 |
-
|
| 193 |
-
|
| 194 |
-
|
| 195 |
-
|
| 196 |
-
|
| 197 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 198 |
|
| 199 |
# Footer
|
| 200 |
st.markdown("""
|
|
|
|
| 65 |
st.markdown("""
|
| 66 |
<style>
|
| 67 |
body {
|
| 68 |
+
background-color: #000000; /* Royal Black */
|
| 69 |
+
color: #ffffff; /* White */
|
| 70 |
}
|
| 71 |
.css-1o7k8tt {
|
| 72 |
+
background-color: #000000; /* Royal Black */
|
| 73 |
+
color: #ffffff; /* White */
|
|
|
|
|
|
|
|
|
|
| 74 |
}
|
| 75 |
.stButton {
|
| 76 |
+
background-color: #ffffff; /* White */
|
| 77 |
+
color: #000000; /* Royal Black */
|
| 78 |
border-radius: 12px;
|
| 79 |
padding: 12px 24px;
|
| 80 |
font-size: 16px;
|
|
|
|
| 82 |
transition: background-color 0.3s, box-shadow 0.3s;
|
| 83 |
}
|
| 84 |
.stButton:hover {
|
| 85 |
+
background-color: #d3d3d3; /* Light Gray */
|
| 86 |
box-shadow: 0 8px 16px rgba(0, 0, 0, 0.5);
|
| 87 |
}
|
| 88 |
.stTextInput, .stTextArea {
|
| 89 |
+
border: 1px solid #ffffff; /* White */
|
| 90 |
border-radius: 12px;
|
| 91 |
+
background-color: #000000; /* Royal Black */
|
| 92 |
+
color: #ffffff; /* White */
|
| 93 |
}
|
| 94 |
.stTextInput::placeholder, .stTextArea::placeholder {
|
| 95 |
+
color: #a0a0a0; /* Gray */
|
| 96 |
}
|
| 97 |
.stSidebar {
|
| 98 |
+
background-color: #000000; /* Royal Black */
|
| 99 |
+
color: #ffffff; /* White */
|
| 100 |
}
|
| 101 |
.stSidebar .stMarkdown {
|
| 102 |
+
color: #ffffff; /* White */
|
| 103 |
}
|
| 104 |
.footer {
|
| 105 |
+
background-color: #000000; /* Royal Black */
|
| 106 |
padding: 15px;
|
| 107 |
text-align: center;
|
| 108 |
+
color: #ffffff; /* White */
|
| 109 |
+
border-top: 1px solid #ffffff; /* White */
|
| 110 |
position: fixed;
|
| 111 |
bottom: 0;
|
| 112 |
width: 100%;
|
|
|
|
| 113 |
}
|
| 114 |
.footer a {
|
| 115 |
+
color: #ffffff; /* White */
|
| 116 |
margin: 0 15px;
|
| 117 |
text-decoration: none;
|
| 118 |
font-size: 18px;
|
| 119 |
}
|
| 120 |
.footer a:hover {
|
| 121 |
+
color: #d3d3d3; /* Light Gray */
|
| 122 |
}
|
| 123 |
.footer i {
|
| 124 |
font-size: 22px;
|
|
|
|
| 126 |
</style>
|
| 127 |
""", unsafe_allow_html=True)
|
| 128 |
|
| 129 |
+
# Sidebar with tasks
|
| 130 |
+
st.sidebar.title("Tasks")
|
| 131 |
+
tasks = [
|
| 132 |
+
"Personalized Learning Assistant",
|
| 133 |
+
"AI Coding Mentor",
|
| 134 |
+
"Smart Document Summarizer",
|
| 135 |
+
"Interactive Study Planner",
|
| 136 |
+
"Real-Time Q&A Support",
|
| 137 |
+
"Mental Health Check-In"
|
| 138 |
+
]
|
| 139 |
+
|
| 140 |
+
selected_task = st.sidebar.radio("Select a task", tasks)
|
| 141 |
+
|
| 142 |
+
# Main layout based on selected task
|
| 143 |
+
if selected_task == "Personalized Learning Assistant":
|
| 144 |
+
st.header("Personalized Learning Assistant")
|
| 145 |
+
with st.form(key="personalized_learning_assistant_form"):
|
| 146 |
+
topic = st.text_area("Enter the topic you want to learn about")
|
| 147 |
+
submit_button = st.form_submit_button("Get Explanation")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 148 |
if submit_button:
|
| 149 |
+
response = personalized_learning_assistant(topic)
|
| 150 |
+
st.write(response)
|
| 151 |
+
|
| 152 |
+
elif selected_task == "AI Coding Mentor":
|
| 153 |
+
st.header("AI Coding Mentor")
|
| 154 |
+
with st.form(key="ai_coding_mentor_form"):
|
| 155 |
+
code_snippet = st.text_area("Paste your code snippet here")
|
| 156 |
+
submit_button = st.form_submit_button("Get Review")
|
| 157 |
+
if submit_button:
|
| 158 |
+
response = ai_coding_mentor(code_snippet)
|
| 159 |
+
st.write(response)
|
| 160 |
+
|
| 161 |
+
elif selected_task == "Smart Document Summarizer":
|
| 162 |
+
st.header("Smart Document Summarizer")
|
| 163 |
+
with st.form(key="smart_document_summarizer_form"):
|
| 164 |
+
document_text = st.text_area("Paste your document text here")
|
| 165 |
+
submit_button = st.form_submit_button("Get Summary")
|
| 166 |
+
if submit_button:
|
| 167 |
+
response = smart_document_summarizer(document_text)
|
| 168 |
+
st.write(response)
|
| 169 |
+
|
| 170 |
+
elif selected_task == "Interactive Study Planner":
|
| 171 |
+
st.header("Interactive Study Planner")
|
| 172 |
+
with st.form(key="interactive_study_planner_form"):
|
| 173 |
+
exam_schedule = st.text_area("Enter your exam schedule here")
|
| 174 |
+
submit_button = st.form_submit_button("Create Study Plan")
|
| 175 |
+
if submit_button:
|
| 176 |
+
response = interactive_study_planner(exam_schedule)
|
| 177 |
+
st.write(response)
|
| 178 |
+
|
| 179 |
+
elif selected_task == "Real-Time Q&A Support":
|
| 180 |
+
st.header("Real-Time Q&A Support")
|
| 181 |
+
with st.form(key="real_time_qa_support_form"):
|
| 182 |
+
question = st.text_area("Ask your academic question here")
|
| 183 |
+
submit_button = st.form_submit_button("Get Answer")
|
| 184 |
+
if submit_button:
|
| 185 |
+
response = real_time_qa_support(question)
|
| 186 |
+
st.write(response)
|
| 187 |
+
|
| 188 |
+
elif selected_task == "Mental Health Check-In":
|
| 189 |
+
st.header("Mental Health Check-In")
|
| 190 |
+
with st.form(key="mental_health_check_in_form"):
|
| 191 |
+
feelings = st.text_area("Share how you are feeling today")
|
| 192 |
+
submit_button = st.form_submit_button("Get Advice")
|
| 193 |
+
if submit_button:
|
| 194 |
+
response = mental_health_check_in(feelings)
|
| 195 |
+
st.write(response)
|
| 196 |
|
| 197 |
# Footer
|
| 198 |
st.markdown("""
|