Wfafa commited on
Commit
a4b1df1
Β·
verified Β·
1 Parent(s): 1a6b058

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +54 -27
app.py CHANGED
@@ -102,64 +102,90 @@ def clear_memory():
102
  os.remove(MEMORY_FILE)
103
  return [], "🧹 Memory cleared! Start fresh."
104
 
105
- # 🎨 Custom CSS for modern look
106
  custom_css = """
107
  body {
108
- background: linear-gradient(135deg, #f0e7ff 0%, #e8e0ff 50%, #f3e9ff 100%);
 
109
  font-family: 'Inter', sans-serif;
 
 
 
110
  }
 
111
  .gradio-container {
112
- background: transparent !important;
113
  }
114
- #eduai-main {
 
115
  display: flex;
116
  flex-direction: row;
117
- gap: 20px;
118
- margin-top: 15px;
119
  }
 
 
120
  .sidebar {
121
- background: #ffffffdd;
122
- border-radius: 20px;
123
- padding: 18px;
124
- box-shadow: 0 4px 20px rgba(100, 0, 200, 0.1);
125
  width: 270px;
 
 
 
 
126
  }
 
 
127
  .chat-area {
128
- background: #ffffff;
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
- padding: 15px 20px 20px 20px;
 
135
  }
 
136
  .chat-header {
137
  text-align: center;
138
  font-size: 1.6em;
139
  font-weight: 700;
140
- color: #5b21b6;
141
- margin-bottom: 10px;
 
142
  }
143
- textarea, input, button {
144
- border-radius: 12px !important;
 
 
 
 
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.Markdown("<div class='chat-header'>πŸŽ“ EduAI β€” Your Smart Study Companion</div>")
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
- "Created by **Wafa Fazly** β€” a passionate Sri Lankan student πŸ‡±πŸ‡° \n"
189
- "EduAI helps learners explore **Science, ICT, English**, and more 🌟"
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=450,
197
- bubble_full_width=False,
198
- render_markdown=True
199
  )
200
  msg = gr.Textbox(
201
- placeholder="πŸ’¬ Type your question here...",
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")