hponepyae commited on
Commit
1ccb0da
·
verified ·
1 Parent(s): 6a14332
Files changed (1) hide show
  1. app.py +20 -8
app.py CHANGED
@@ -72,11 +72,20 @@ def handle_conversation_turn(user_input: str, user_image: Image.Image, history:
72
  print(f"An exception occurred during conversation turn: {type(e).__name__}: {e}")
73
  yield history, history
74
 
75
- # --- UI MODIFICATION: Final CSS for a white background and professional look ---
76
  css = """
77
- /* Main App Styling */
78
- gradio-app { background-color: #ffffff !important; }
79
- #chat-container { background: transparent; flex-grow: 1; overflow-y: auto; padding-bottom: 200px !important; }
 
 
 
 
 
 
 
 
 
80
  /* Chat Bubble Styling */
81
  .user > .message-bubble-row .message-bubble { background-color: #dbeafe !important; color: #1f2937 !important; border-top-right-radius: 5px !important; }
82
  .bot > .message-bubble-row .message-bubble { background-color: #f3f4f6 !important; color: #1f2937 !important; border-top-left-radius: 5px !important; }
@@ -89,10 +98,10 @@ gradio-app { background-color: #ffffff !important; }
89
  }
90
  /* Text Input Box Styling */
91
  #user-textbox textarea {
92
- background-color: #ffffff !important;
93
  border: 1px solid #d1d5db !important;
94
  border-radius: 10px !important;
95
- color: #111827 !important; /* Darker input text */
96
  }
97
  /* Icon Button General Styling */
98
  .icon-btn {
@@ -105,12 +114,15 @@ gradio-app { background-color: #ffffff !important; }
105
  #upload-btn, #send-btn { background-color: #3b82f6 !important; color: white !important; }
106
  """
107
 
108
- with gr.Blocks(theme=gr.themes.Base(), title="AI Doctor Consultation", css=css) as demo:
 
109
  conversation_history = gr.State([])
110
 
 
111
  with gr.Column(elem_id="chat-container"):
112
- chatbot_display = gr.Chatbot(label="Consultation", show_copy_button=True, bubble_full_width=False, avatar_images=("./images/user.png", "./images/bot.png"))
113
 
 
114
  with gr.Column(elem_id="footer-container"):
115
  with gr.Row():
116
  image_preview = gr.Image(type="pil", height=60, width=60, visible=False, show_label=False, container=False, scale=1)
 
72
  print(f"An exception occurred during conversation turn: {type(e).__name__}: {e}")
73
  yield history, history
74
 
75
+ # --- UI MODIFICATION: Final CSS for a clean, white background ---
76
  css = """
77
+ /* Set a base background for the overall app if needed */
78
+ .gradio-container { background-color: #f9fafb !important; }
79
+ /* THIS IS THE KEY FIX: Target the chat container directly for a white background */
80
+ #chat-container {
81
+ background-color: #ffffff !important;
82
+ flex-grow: 1;
83
+ overflow-y: auto;
84
+ padding: 1rem;
85
+ border: 1px solid #e5e7eb;
86
+ border-radius: 12px;
87
+ margin-bottom: 120px !important; /* Space for the sticky footer */
88
+ }
89
  /* Chat Bubble Styling */
90
  .user > .message-bubble-row .message-bubble { background-color: #dbeafe !important; color: #1f2937 !important; border-top-right-radius: 5px !important; }
91
  .bot > .message-bubble-row .message-bubble { background-color: #f3f4f6 !important; color: #1f2937 !important; border-top-left-radius: 5px !important; }
 
98
  }
99
  /* Text Input Box Styling */
100
  #user-textbox textarea {
101
+ background-color: #f9fafb !important;
102
  border: 1px solid #d1d5db !important;
103
  border-radius: 10px !important;
104
+ color: #111827 !important;
105
  }
106
  /* Icon Button General Styling */
107
  .icon-btn {
 
114
  #upload-btn, #send-btn { background-color: #3b82f6 !important; color: white !important; }
115
  """
116
 
117
+ # Reverting to gr.themes.Soft() for a reliable light theme foundation
118
+ with gr.Blocks(theme=gr.themes.Soft(), title="AI Doctor Consultation", css=css) as demo:
119
  conversation_history = gr.State([])
120
 
121
+ # The main content area now has the specific ID for styling.
122
  with gr.Column(elem_id="chat-container"):
123
+ chatbot_display = gr.Chatbot(elem_id="chatbot", label="Consultation", show_copy_button=True, bubble_full_width=False, avatar_images=("./images/user.png", "./images/bot.png"))
124
 
125
+ # The sticky footer for inputs
126
  with gr.Column(elem_id="footer-container"):
127
  with gr.Row():
128
  image_preview = gr.Image(type="pil", height=60, width=60, visible=False, show_label=False, container=False, scale=1)