Yaswanth123 commited on
Commit
69a03fa
·
verified ·
1 Parent(s): 15bfe83

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +43 -52
app.py CHANGED
@@ -249,74 +249,65 @@ def handle_user_interaction(
249
  app_tabs_update,
250
  documentation_update,
251
  )
 
252
  custom_css = """
253
  /* --- Overall Page & Theme --- */
254
  .gradio-container {
255
- background: #F9FAFB; /* Soft off-white/light gray background */
256
- font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif !important;
257
- padding-top: 0 !important; /* Remove top padding to let header be flush */
258
  }
259
-
260
- /* --- Hero Header Section --- */
261
- #app-header-container {
262
- background: white;
263
- border-bottom: 1px solid #E5E7EB;
264
- padding: 1.5rem 2rem !important;
265
- margin-bottom: 1.5rem !important;
266
  }
267
- #app-header h1 {
268
- text-align: center;
269
- font-size: 2.25rem !important;
270
- font-weight: 800 !important;
271
- color: #1F2937; /* Very dark gray for high contrast */
272
- margin-bottom: 0.5rem !important;
273
  }
274
- #app-header p {
275
- text-align: center;
276
- font-size: 1.1rem !important;
277
- color: #4B5563; /* Softer gray for subtitle */
278
- margin-bottom: 0 !important;
279
  }
280
 
281
  /* --- Main Application Tabs --- */
282
  #app-tabs .tab-nav button {
283
- font-size: 1.1rem !important;
284
- font-weight: 600 !important;
285
- border-radius: 8px 8px 0 0 !important;
286
- border-bottom: 3px solid transparent !important;
287
- transition: all 0.2s ease-in-out;
288
- background: transparent !important;
289
  }
290
  #app-tabs .tab-nav button.selected {
291
- border-bottom-color: #4F46E5 !important; /* A strong indigo accent color */
292
- background: white !important;
293
  color: #4F46E5 !important;
294
  }
295
-
296
- /* --- Compact & Styled Buttons --- */
297
- .sm-button {
298
- min-width: 0 !important;
299
- padding: 0.2rem 0.6rem !important;
300
- height: 34px !important;
301
- line-height: 1 !important;
302
- align-self: center !important;
303
- margin: 0 !important;
304
- border-radius: 8px !important;
305
- border: 1px solid #D1D5DB !important;
306
- background: white !important;
307
- color: #4B5563 !important;
308
- box-shadow: 0 1px 2px 0 rgba(0,0,0,0.05);
309
- transition: background-color 0.2s ease;
310
  }
311
- .sm-button:hover { background: #F9FAFB !important; }
312
 
313
- /* --- Chat Interface Polish --- */
314
- .chat-input-row { margin-top: 10px; }
315
  #chatbot {
316
- min-height: 600px;
317
- box-shadow: none !important;
318
  border: 1px solid #E5E7EB !important;
319
- background-color: white !important;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
320
  }
321
  """
322
  # --- Gradio UI Definition ---
@@ -365,13 +356,13 @@ with gr.Blocks(theme=gr.themes.Soft(), css=custom_css, title="AI Syllabus Archit
365
  chatbot = gr.Chatbot(initial_chat_ui, elem_id="chatbot", type="messages", show_label=False, render_markdown=True, avatar_images=(None, "https://i.imgur.com/3pyR0Vf.png"), latex_delimiters=[{"left": "$$", "right": "$$", "display": True}, {"left": "$", "right": "$", "display": False}])
366
  with gr.Row(elem_classes="chat-input-row"):
367
  looks_good_btn = gr.Button("looks good", size="sm", visible=False)
368
- with gr.Row():
369
  user_input_textbox = gr.Textbox(scale=4, show_label=False, placeholder="Type your message or upload files and press Enter...", container=False)
370
  send_button = gr.Button("Send", variant="primary", scale=1, min_width=150)
371
 
372
  # --- TOOLS SIDEBAR COLUMN (Correctly nested inside the Chat Tab's Row) ---
373
  with gr.Column(scale=3, visible=True) as tools_sidebar:
374
- close_sidebar_btn = gr.Button("Close Sidebar ➡️", elem_classes="sm-button")
375
  with gr.Accordion("🛠️ Session Content", open=True):
376
  gr.Markdown("### 📄 Resources")
377
  file_uploader = gr.File(label="Upload Learning Materials (First Turn Only)", file_count="multiple", file_types=[".pdf", ".docx", ".txt"], interactive=True)
 
249
  app_tabs_update,
250
  documentation_update,
251
  )
252
+ # --- NEW AESTHETIC CSS ---
253
  custom_css = """
254
  /* --- Overall Page & Theme --- */
255
  .gradio-container {
256
+ background-color: #F9FAFB; /* Light mode background */
 
 
257
  }
258
+ .dark .gradio-container {
259
+ background-color: #111827; /* Dark mode background */
 
 
 
 
 
260
  }
261
+
262
+ /* --- Collapsible Header Section --- */
263
+ #app-header {
264
+ color: #374151; /* Light mode text */
 
 
265
  }
266
+ .dark #app-header {
267
+ color: #D1D5DB; /* Dark mode text */
 
 
 
268
  }
269
 
270
  /* --- Main Application Tabs --- */
271
  #app-tabs .tab-nav button {
272
+ background-color: transparent !important;
273
+ border-bottom: 2px solid transparent !important;
 
 
 
 
274
  }
275
  #app-tabs .tab-nav button.selected {
276
+ border-bottom-color: #4F46E5 !important; /* Accent color */
 
277
  color: #4F46E5 !important;
278
  }
279
+ .dark #app-tabs .tab-nav button {
280
+ color: #9CA3AF;
281
+ }
282
+ .dark #app-tabs .tab-nav button.selected {
283
+ background-color: #1F2937 !important; /* Darker tab background */
284
+ color: #A5B4FC !important;
285
+ border-bottom-color: #A5B4FC !important;
 
 
 
 
 
 
 
 
286
  }
 
287
 
288
+ /* --- FIX FOR CHATBOT APPEARANCE AND SPACING --- */
 
289
  #chatbot {
290
+ background-color: white !important; /* Distinct white background for chatbot */
 
291
  border: 1px solid #E5E7EB !important;
292
+ border-radius: 12px !important;
293
+ box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.05) !important;
294
+ margin-bottom: 0 !important; /* Remove bottom margin to close the gap */
295
+ }
296
+ .dark #chatbot {
297
+ background-color: #1F2937 !important; /* Dark but distinct background */
298
+ border: 1px solid #374151 !important;
299
+ }
300
+
301
+ /* FIX: Target the input row to remove the top margin, closing the gap */
302
+ .chat-input-container {
303
+ padding-top: 1rem !important;
304
+ }
305
+
306
+ /* --- Compact & Styled Buttons (already good, no changes needed) --- */
307
+ .sm-button {
308
+ min-width: 0 !important;
309
+ padding: 0.2rem 0.6rem !important;
310
+ /* ... other styles */
311
  }
312
  """
313
  # --- Gradio UI Definition ---
 
356
  chatbot = gr.Chatbot(initial_chat_ui, elem_id="chatbot", type="messages", show_label=False, render_markdown=True, avatar_images=(None, "https://i.imgur.com/3pyR0Vf.png"), latex_delimiters=[{"left": "$$", "right": "$$", "display": True}, {"left": "$", "right": "$", "display": False}])
357
  with gr.Row(elem_classes="chat-input-row"):
358
  looks_good_btn = gr.Button("looks good", size="sm", visible=False)
359
+ with gr.Row(elem_classes="chat-input-container"):
360
  user_input_textbox = gr.Textbox(scale=4, show_label=False, placeholder="Type your message or upload files and press Enter...", container=False)
361
  send_button = gr.Button("Send", variant="primary", scale=1, min_width=150)
362
 
363
  # --- TOOLS SIDEBAR COLUMN (Correctly nested inside the Chat Tab's Row) ---
364
  with gr.Column(scale=3, visible=True) as tools_sidebar:
365
+ close_sidebar_btn = gr.Button("⬅️ Close Sidebar", elem_classes="sm-button")
366
  with gr.Accordion("🛠️ Session Content", open=True):
367
  gr.Markdown("### 📄 Resources")
368
  file_uploader = gr.File(label="Upload Learning Materials (First Turn Only)", file_count="multiple", file_types=[".pdf", ".docx", ".txt"], interactive=True)