waghib commited on
Commit
826ce43
·
verified ·
1 Parent(s): f2a3666

updated qna bug

Browse files
Files changed (1) hide show
  1. app.py +52 -28
app.py CHANGED
@@ -272,6 +272,7 @@ def main():
272
 
273
  # Custom CSS for modern look with dark theme compatibility
274
  st.markdown("""
 
275
  <style>
276
  /* Remove background overrides that conflict with dark theme */
277
  .stApp {max-width: 1200px; margin: 0 auto;}
@@ -290,9 +291,15 @@ def main():
290
  .source-box {background-color: rgba(255, 255, 255, 0.1); color: inherit; border-radius: 5px; padding: 15px; margin-bottom: 10px; border-left: 5px solid #3498db;}
291
  .metrics-box {background-color: rgba(255, 255, 255, 0.1); color: inherit; border-radius: 5px; padding: 15px; margin-top: 20px;}
292
 
293
- /* Feature cards for homepage */
294
- .feature-card {background-color: rgba(255, 255, 255, 0.1); color: inherit; border-radius: 10px; padding: 20px; min-height: 220px; box-shadow: 0 4px 6px rgba(0,0,0,0.1); display: flex; flex-direction: column; align-items: center;}
295
- .feature-card p {font-size: 0.9em; margin-top: 5px; max-width: 100%; overflow-wrap: break-word; word-wrap: break-word;}
 
 
 
 
 
 
296
 
297
  /* Fixed input container */
298
  .input-container {margin-bottom: 20px; padding: 15px; border-radius: 10px; background-color: rgba(255, 255, 255, 0.05); border: 1px solid rgba(255, 255, 255, 0.1);}
@@ -347,37 +354,54 @@ def main():
347
  </div>
348
  """, unsafe_allow_html=True)
349
 
350
- # Features section
351
  st.markdown("<br><br>", unsafe_allow_html=True)
352
  st.markdown("<h2 style='text-align:center;'>Key Features</h2>", unsafe_allow_html=True)
353
 
354
- col1, col2, col3 = st.columns(3)
355
- with col1:
356
- st.markdown("""
357
- <div class='feature-card'>
358
- <img src="https://img.icons8.com/color/48/000000/search--v1.png">
359
- <h3>Intelligent Retrieval</h3>
360
- <p>Finds the most relevant clinical information from the MIMIC-IV-Ext dataset</p>
 
 
 
 
361
  </div>
362
- """, unsafe_allow_html=True)
363
 
364
- with col2:
365
- st.markdown("""
366
- <div class='feature-card'>
367
- <img src="https://img.icons8.com/color/48/000000/brain.png">
368
- <h3>Advanced Reasoning</h3>
369
- <p>Applies clinical knowledge to generate accurate diagnostic insights</p>
 
 
370
  </div>
371
- """, unsafe_allow_html=True)
372
 
373
- with col3:
374
- st.markdown("""
375
- <div class='feature-card'>
376
- <img src="https://img.icons8.com/color/48/000000/document.png">
377
- <h3>Source Transparency</h3>
378
- <p>Provides references to all clinical sources used in generating responses</p>
 
 
379
  </div>
380
- """, unsafe_allow_html=True)
 
 
 
 
 
 
 
 
 
 
 
381
 
382
  # Chat interface
383
  elif st.session_state.page == 'chat':
@@ -424,8 +448,8 @@ def main():
424
  response = run_rag_chat(user_input, st.session_state.vectorstore)
425
  response["retriever"] = st.session_state.vectorstore.as_retriever()
426
 
427
- # Add to chat history
428
- st.session_state.chat_history.append((user_input, response))
429
 
430
  # Clear the input field
431
  st.session_state.user_input = ""
 
272
 
273
  # Custom CSS for modern look with dark theme compatibility
274
  st.markdown("""
275
+ <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css">
276
  <style>
277
  /* Remove background overrides that conflict with dark theme */
278
  .stApp {max-width: 1200px; margin: 0 auto;}
 
291
  .source-box {background-color: rgba(255, 255, 255, 0.1); color: inherit; border-radius: 5px; padding: 15px; margin-bottom: 10px; border-left: 5px solid #3498db;}
292
  .metrics-box {background-color: rgba(255, 255, 255, 0.1); color: inherit; border-radius: 5px; padding: 15px; margin-top: 20px;}
293
 
294
+ /* Modern feature items with gradient backgrounds */
295
+ .features-container {display: flex; flex-wrap: wrap; gap: 20px; justify-content: center; margin-top: 30px;}
296
+ .feature-item {flex: 1 1 calc(50% - 20px); min-width: 300px; display: flex; align-items: center; padding: 20px; border-radius: 10px; background: linear-gradient(135deg, rgba(72, 126, 176, 0.1), rgba(72, 126, 176, 0.2)); transition: transform 0.3s, box-shadow 0.3s; border: 1px solid rgba(255, 255, 255, 0.1);}
297
+ .feature-item:hover {transform: translateY(-5px); box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);}
298
+ .feature-icon {width: 60px; height: 60px; border-radius: 50%; background: linear-gradient(135deg, #3498db, #2980b9); display: flex; align-items: center; justify-content: center; margin-right: 20px; box-shadow: 0 5px 15px rgba(52, 152, 219, 0.3);}
299
+ .feature-icon i {font-size: 24px; color: white;}
300
+ .feature-content {flex: 1;}
301
+ .feature-content h3 {margin-top: 0; margin-bottom: 10px; color: inherit;}
302
+ .feature-content p {margin: 0; font-size: 0.9em; color: inherit; opacity: 0.8;}
303
 
304
  /* Fixed input container */
305
  .input-container {margin-bottom: 20px; padding: 15px; border-radius: 10px; background-color: rgba(255, 255, 255, 0.05); border: 1px solid rgba(255, 255, 255, 0.1);}
 
354
  </div>
355
  """, unsafe_allow_html=True)
356
 
357
+ # Modern Features section with gradient backgrounds and icons
358
  st.markdown("<br><br>", unsafe_allow_html=True)
359
  st.markdown("<h2 style='text-align:center;'>Key Features</h2>", unsafe_allow_html=True)
360
 
361
+ # Modern feature list with gradient backgrounds
362
+ st.markdown("""
363
+ <div class="features-container">
364
+ <div class="feature-item">
365
+ <div class="feature-icon">
366
+ <i class="fas fa-search"></i>
367
+ </div>
368
+ <div class="feature-content">
369
+ <h3>Intelligent Retrieval</h3>
370
+ <p>Finds the most relevant clinical information from the MIMIC-IV-Ext dataset</p>
371
+ </div>
372
  </div>
 
373
 
374
+ <div class="feature-item">
375
+ <div class="feature-icon">
376
+ <i class="fas fa-brain"></i>
377
+ </div>
378
+ <div class="feature-content">
379
+ <h3>Advanced Reasoning</h3>
380
+ <p>Applies clinical knowledge to generate accurate diagnostic insights</p>
381
+ </div>
382
  </div>
 
383
 
384
+ <div class="feature-item">
385
+ <div class="feature-icon">
386
+ <i class="fas fa-file-medical-alt"></i>
387
+ </div>
388
+ <div class="feature-content">
389
+ <h3>Source Transparency</h3>
390
+ <p>Provides references to all clinical sources used in generating responses</p>
391
+ </div>
392
  </div>
393
+
394
+ <div class="feature-item">
395
+ <div class="feature-icon">
396
+ <i class="fas fa-moon"></i>
397
+ </div>
398
+ <div class="feature-content">
399
+ <h3>Dark/Light Theme Compatible</h3>
400
+ <p>Optimized interface that works seamlessly in both dark and light themes</p>
401
+ </div>
402
+ </div>
403
+ </div>
404
+ """, unsafe_allow_html=True)
405
 
406
  # Chat interface
407
  elif st.session_state.page == 'chat':
 
448
  response = run_rag_chat(user_input, st.session_state.vectorstore)
449
  response["retriever"] = st.session_state.vectorstore.as_retriever()
450
 
451
+ # Clear previous chat history and only keep the current response
452
+ st.session_state.chat_history = [(user_input, response)]
453
 
454
  # Clear the input field
455
  st.session_state.user_input = ""