Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -102,64 +102,90 @@ def clear_memory():
|
|
| 102 |
os.remove(MEMORY_FILE)
|
| 103 |
return [], "π§Ή Memory cleared! Start fresh."
|
| 104 |
|
| 105 |
-
# π¨
|
| 106 |
custom_css = """
|
| 107 |
body {
|
| 108 |
-
background:
|
|
|
|
| 109 |
font-family: 'Inter', sans-serif;
|
|
|
|
|
|
|
|
|
|
| 110 |
}
|
|
|
|
| 111 |
.gradio-container {
|
| 112 |
-
background:
|
| 113 |
}
|
| 114 |
-
|
|
|
|
| 115 |
display: flex;
|
| 116 |
flex-direction: row;
|
| 117 |
-
|
| 118 |
-
|
| 119 |
}
|
|
|
|
|
|
|
| 120 |
.sidebar {
|
| 121 |
-
background: #
|
| 122 |
-
|
| 123 |
-
padding: 18px;
|
| 124 |
-
box-shadow: 0 4px 20px rgba(100, 0, 200, 0.1);
|
| 125 |
width: 270px;
|
|
|
|
|
|
|
|
|
|
|
|
|
| 126 |
}
|
|
|
|
|
|
|
| 127 |
.chat-area {
|
| 128 |
-
background: #
|
| 129 |
-
border-radius: 20px;
|
| 130 |
flex-grow: 1;
|
| 131 |
-
box-shadow: 0 4px 25px rgba(120, 0, 180, 0.15);
|
| 132 |
display: flex;
|
| 133 |
flex-direction: column;
|
| 134 |
-
|
|
|
|
| 135 |
}
|
|
|
|
| 136 |
.chat-header {
|
| 137 |
text-align: center;
|
| 138 |
font-size: 1.6em;
|
| 139 |
font-weight: 700;
|
| 140 |
-
color: #
|
| 141 |
-
|
|
|
|
| 142 |
}
|
| 143 |
-
|
| 144 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 145 |
}
|
|
|
|
| 146 |
button {
|
| 147 |
background: linear-gradient(135deg, #7c3aed, #9333ea) !important;
|
| 148 |
color: white !important;
|
|
|
|
| 149 |
border: none !important;
|
| 150 |
transition: 0.2s ease-in-out;
|
| 151 |
}
|
|
|
|
| 152 |
button:hover {
|
| 153 |
transform: scale(1.05);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 154 |
}
|
| 155 |
"""
|
| 156 |
|
| 157 |
# π Interface
|
| 158 |
with gr.Blocks(css=custom_css) as iface:
|
| 159 |
-
gr.
|
| 160 |
-
|
| 161 |
-
with gr.Row(elem_id="eduai-main"):
|
| 162 |
with gr.Column(elem_classes=["sidebar"]):
|
|
|
|
| 163 |
gr.Markdown("### π§ Main Menu")
|
| 164 |
|
| 165 |
with gr.Accordion("π Subject Tutor", open=False):
|
|
@@ -185,20 +211,21 @@ with gr.Blocks(css=custom_css) as iface:
|
|
| 185 |
|
| 186 |
gr.Markdown(
|
| 187 |
"π©βπ **About EduAI** \n"
|
| 188 |
-
"
|
| 189 |
-
"EduAI helps
|
| 190 |
)
|
| 191 |
|
| 192 |
with gr.Column(elem_classes=["chat-area"]):
|
|
|
|
| 193 |
context_display = gr.Markdown("π **You are in General Mode.** Ask EduAI anything!")
|
| 194 |
chatbot = gr.Chatbot(
|
| 195 |
label="",
|
| 196 |
-
height=
|
| 197 |
-
|
| 198 |
-
|
| 199 |
)
|
| 200 |
msg = gr.Textbox(
|
| 201 |
-
placeholder="
|
| 202 |
show_label=False
|
| 203 |
)
|
| 204 |
send = gr.Button("β¨ Send Message")
|
|
|
|
| 102 |
os.remove(MEMORY_FILE)
|
| 103 |
return [], "π§Ή Memory cleared! Start fresh."
|
| 104 |
|
| 105 |
+
# π¨ Dark theme CSS
|
| 106 |
custom_css = """
|
| 107 |
body {
|
| 108 |
+
background-color: #0f0f12;
|
| 109 |
+
color: #f0f0f0;
|
| 110 |
font-family: 'Inter', sans-serif;
|
| 111 |
+
margin: 0;
|
| 112 |
+
height: 100vh;
|
| 113 |
+
overflow: hidden;
|
| 114 |
}
|
| 115 |
+
|
| 116 |
.gradio-container {
|
| 117 |
+
background-color: #0f0f12 !important;
|
| 118 |
}
|
| 119 |
+
|
| 120 |
+
#eduai-layout {
|
| 121 |
display: flex;
|
| 122 |
flex-direction: row;
|
| 123 |
+
height: 100vh;
|
| 124 |
+
overflow: hidden;
|
| 125 |
}
|
| 126 |
+
|
| 127 |
+
/* Sidebar */
|
| 128 |
.sidebar {
|
| 129 |
+
background-color: #18181c;
|
| 130 |
+
color: #e0e0e0;
|
|
|
|
|
|
|
| 131 |
width: 270px;
|
| 132 |
+
padding: 18px;
|
| 133 |
+
display: flex;
|
| 134 |
+
flex-direction: column;
|
| 135 |
+
border-right: 1px solid #2c2c2f;
|
| 136 |
}
|
| 137 |
+
|
| 138 |
+
/* Chat Area */
|
| 139 |
.chat-area {
|
| 140 |
+
background-color: #111113;
|
|
|
|
| 141 |
flex-grow: 1;
|
|
|
|
| 142 |
display: flex;
|
| 143 |
flex-direction: column;
|
| 144 |
+
justify-content: space-between;
|
| 145 |
+
padding: 10px 20px 20px 20px;
|
| 146 |
}
|
| 147 |
+
|
| 148 |
.chat-header {
|
| 149 |
text-align: center;
|
| 150 |
font-size: 1.6em;
|
| 151 |
font-weight: 700;
|
| 152 |
+
color: #a78bfa;
|
| 153 |
+
padding: 15px;
|
| 154 |
+
border-bottom: 1px solid #2c2c2f;
|
| 155 |
}
|
| 156 |
+
|
| 157 |
+
textarea, input {
|
| 158 |
+
background-color: #1e1e22 !important;
|
| 159 |
+
color: #f0f0f0 !important;
|
| 160 |
+
border-radius: 10px !important;
|
| 161 |
+
border: 1px solid #3a3a3d !important;
|
| 162 |
}
|
| 163 |
+
|
| 164 |
button {
|
| 165 |
background: linear-gradient(135deg, #7c3aed, #9333ea) !important;
|
| 166 |
color: white !important;
|
| 167 |
+
border-radius: 10px !important;
|
| 168 |
border: none !important;
|
| 169 |
transition: 0.2s ease-in-out;
|
| 170 |
}
|
| 171 |
+
|
| 172 |
button:hover {
|
| 173 |
transform: scale(1.05);
|
| 174 |
+
filter: brightness(1.2);
|
| 175 |
+
}
|
| 176 |
+
|
| 177 |
+
/* Chatbot bubble style */
|
| 178 |
+
.chatbot > div {
|
| 179 |
+
background-color: #1a1a1d !important;
|
| 180 |
+
border-radius: 12px;
|
| 181 |
}
|
| 182 |
"""
|
| 183 |
|
| 184 |
# π Interface
|
| 185 |
with gr.Blocks(css=custom_css) as iface:
|
| 186 |
+
with gr.Row(elem_id="eduai-layout"):
|
|
|
|
|
|
|
| 187 |
with gr.Column(elem_classes=["sidebar"]):
|
| 188 |
+
gr.Markdown("## π EduAI")
|
| 189 |
gr.Markdown("### π§ Main Menu")
|
| 190 |
|
| 191 |
with gr.Accordion("π Subject Tutor", open=False):
|
|
|
|
| 211 |
|
| 212 |
gr.Markdown(
|
| 213 |
"π©βπ **About EduAI** \n"
|
| 214 |
+
"Developed by **Wafa Fazly**, a passionate Sri Lankan student π±π° \n"
|
| 215 |
+
"EduAI helps students explore **Science, ICT, English**, and more π"
|
| 216 |
)
|
| 217 |
|
| 218 |
with gr.Column(elem_classes=["chat-area"]):
|
| 219 |
+
gr.Markdown("<div class='chat-header'>π¬ EduAI β Smart Study Assistant</div>")
|
| 220 |
context_display = gr.Markdown("π **You are in General Mode.** Ask EduAI anything!")
|
| 221 |
chatbot = gr.Chatbot(
|
| 222 |
label="",
|
| 223 |
+
height=460,
|
| 224 |
+
render_markdown=True,
|
| 225 |
+
bubble_full_width=False
|
| 226 |
)
|
| 227 |
msg = gr.Textbox(
|
| 228 |
+
placeholder="π Type your question here...",
|
| 229 |
show_label=False
|
| 230 |
)
|
| 231 |
send = gr.Button("β¨ Send Message")
|