jdesiree commited on
Commit
11e992c
Β·
verified Β·
1 Parent(s): 6d62536

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +67 -6
app.py CHANGED
@@ -175,7 +175,7 @@ theme = gr.themes.Glass(
175
  button_border_width='*block_border_width'
176
  )
177
 
178
- # Responsive interface with flexible height
179
  with gr.Blocks(theme=theme, css="""
180
  .main-container {
181
  max-width: 900px;
@@ -206,9 +206,63 @@ with gr.Blocks(theme=theme, css="""
206
  min-height: 400px;
207
  max-height: calc(100vh - 200px);
208
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
209
  .input-row {
210
  flex-shrink: 0;
211
  margin-top: 0.5rem;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
212
  }
213
 
214
  /* Mobile responsiveness */
@@ -226,6 +280,12 @@ with gr.Blocks(theme=theme, css="""
226
  }
227
  .input-row {
228
  margin-top: 0.25rem;
 
 
 
 
 
 
229
  }
230
  }
231
 
@@ -268,21 +328,22 @@ with gr.Blocks(theme=theme, css="""
268
  with gr.Column(elem_classes=["chat-container"]):
269
  chatbot = gr.Chatbot(
270
  show_copy_button=True,
271
- avatar_images=["πŸ‘€", "πŸŽ“"],
272
  placeholder="Hi! I'm EduBot. What would you like to learn today? πŸ“š",
273
  container=True,
274
  elem_classes=["gradio-chatbot"]
275
  )
276
 
277
- # Textbox and send button
278
  with gr.Row(elem_classes=["input-row"]):
279
  msg = gr.Textbox(
280
  placeholder="Ask me about math, research, study strategies, or any educational topic...",
281
  container=False,
282
  show_label=False,
283
- scale=8
 
284
  )
285
- send_btn = gr.Button("πŸ“€ Send", variant="primary", scale=1)
286
 
287
  # Enhanced response function
288
  def respond_and_update(message, history):
@@ -304,5 +365,5 @@ with gr.Blocks(theme=theme, css="""
304
  )
305
 
306
  if __name__ == "__main__":
307
- logger.info("Starting EduBot with responsive interface...")
308
  demo.launch()
 
175
  button_border_width='*block_border_width'
176
  )
177
 
178
+ # Responsive interface with flexible height and custom styling
179
  with gr.Blocks(theme=theme, css="""
180
  .main-container {
181
  max-width: 900px;
 
206
  min-height: 400px;
207
  max-height: calc(100vh - 200px);
208
  }
209
+
210
+ /* Hide the chat icon */
211
+ .chat-bot .message-wrap .avatar-container {
212
+ display: none !important;
213
+ }
214
+ .gradio-chatbot .message-wrap .avatar-container {
215
+ display: none !important;
216
+ }
217
+ .gradio-chatbot .message.bot .avatar-container,
218
+ .gradio-chatbot .message.user .avatar-container {
219
+ display: none !important;
220
+ }
221
+
222
+ /* Style the input area */
223
  .input-row {
224
  flex-shrink: 0;
225
  margin-top: 0.5rem;
226
+ display: flex;
227
+ justify-content: center;
228
+ align-items: center;
229
+ gap: 10px;
230
+ max-width: 700px;
231
+ margin-left: auto;
232
+ margin-right: auto;
233
+ }
234
+
235
+ /* Custom textbox styling */
236
+ .custom-textbox input {
237
+ border-radius: 25px !important;
238
+ border: 2px solid #64748b !important;
239
+ padding: 15px 20px !important;
240
+ font-size: 16px !important;
241
+ background: white !important;
242
+ outline: none !important;
243
+ box-shadow: 0 2px 4px rgba(0,0,0,0.1) !important;
244
+ transition: all 0.3s ease !important;
245
+ }
246
+
247
+ .custom-textbox input:focus {
248
+ border-color: #475569 !important;
249
+ box-shadow: 0 0 0 3px rgba(100, 116, 139, 0.1) !important;
250
+ }
251
+
252
+ /* Remove textbox label */
253
+ .custom-textbox label {
254
+ display: none !important;
255
+ }
256
+
257
+ /* Center the send button */
258
+ .send-button {
259
+ border-radius: 50% !important;
260
+ width: 50px !important;
261
+ height: 50px !important;
262
+ display: flex !important;
263
+ align-items: center !important;
264
+ justify-content: center !important;
265
+ flex-shrink: 0 !important;
266
  }
267
 
268
  /* Mobile responsiveness */
 
280
  }
281
  .input-row {
282
  margin-top: 0.25rem;
283
+ max-width: 100%;
284
+ padding: 0 0.5rem;
285
+ }
286
+ .custom-textbox input {
287
+ padding: 12px 15px !important;
288
+ font-size: 14px !important;
289
  }
290
  }
291
 
 
328
  with gr.Column(elem_classes=["chat-container"]):
329
  chatbot = gr.Chatbot(
330
  show_copy_button=True,
331
+ avatar_images=[None, None], # Remove avatars
332
  placeholder="Hi! I'm EduBot. What would you like to learn today? πŸ“š",
333
  container=True,
334
  elem_classes=["gradio-chatbot"]
335
  )
336
 
337
+ # Centered textbox and send button
338
  with gr.Row(elem_classes=["input-row"]):
339
  msg = gr.Textbox(
340
  placeholder="Ask me about math, research, study strategies, or any educational topic...",
341
  container=False,
342
  show_label=False,
343
+ scale=8,
344
+ elem_classes=["custom-textbox"]
345
  )
346
+ send_btn = gr.Button("πŸ“€", variant="primary", scale=1, elem_classes=["send-button"])
347
 
348
  # Enhanced response function
349
  def respond_and_update(message, history):
 
365
  )
366
 
367
  if __name__ == "__main__":
368
+ logger.info("Starting EduBot with custom styling...")
369
  demo.launch()