Cascade Bot commited on
Commit
3a45eb3
·
1 Parent(s): b065baa

style: enhance Gradio interface styling

Browse files

- Update theme configuration with proper colors and fonts
- Enhance CSS with responsive design
- Add CSS variables for consistent theming
- Improve chatbot component styling
- Add avatars and likeable messages

Files changed (1) hide show
  1. app.py +51 -13
app.py CHANGED
@@ -196,33 +196,66 @@ class ChatInterface:
196
  with gr.Blocks(
197
  title="Advanced Agentic System",
198
  theme=gr.themes.Soft(
199
- primary_hue="blue",
200
- secondary_hue="slate",
201
- neutral_hue="slate",
202
- spacing_size=gr.themes.sizes.spacing_md,
203
- radius_size=gr.themes.sizes.radius_md,
204
- text_size=gr.themes.sizes.text_md,
 
205
  ),
206
  css="""
207
  .gradio-container {
208
  max-width: 1200px !important;
209
  margin: auto;
210
  padding: 20px;
 
211
  }
212
  .chat-message {
213
  padding: 15px;
214
- border-radius: 10px;
215
- margin-bottom: 10px;
 
216
  }
217
  .user-message {
218
- background-color: #f0f0f0;
 
219
  }
220
  .assistant-message {
221
- background-color: #e3f2fd;
 
 
 
 
 
 
 
 
 
 
 
 
222
  }
223
  footer {display: none !important;}
224
  .gradio-container {min-height: 100vh !important;}
225
- .main {flex-grow: 1;}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
226
  """
227
  ) as interface:
228
  gr.Markdown("""
@@ -246,13 +279,18 @@ class ChatInterface:
246
 
247
  chatbot = gr.Chatbot(
248
  label="Chat History",
249
- height=500,
250
  bubble_full_width=False,
251
  show_copy_button=True,
252
  render_markdown=True,
253
  container=True,
 
 
 
254
  elem_classes=["chat-window"],
255
- type="messages" # Use the new message format
 
 
256
  )
257
 
258
  with gr.Row():
 
196
  with gr.Blocks(
197
  title="Advanced Agentic System",
198
  theme=gr.themes.Soft(
199
+ primary_hue=gr.themes.colors.blue,
200
+ secondary_hue=gr.themes.colors.sky,
201
+ neutral_hue=gr.themes.colors.gray,
202
+ spacing_size="lg",
203
+ radius_size="lg",
204
+ text_size="lg",
205
+ font=["Poppins", "ui-sans-serif", "system-ui", "sans-serif"],
206
  ),
207
  css="""
208
  .gradio-container {
209
  max-width: 1200px !important;
210
  margin: auto;
211
  padding: 20px;
212
+ font-family: 'Poppins', ui-sans-serif, system-ui, sans-serif;
213
  }
214
  .chat-message {
215
  padding: 15px;
216
+ border-radius: 12px;
217
+ margin-bottom: 12px;
218
+ line-height: 1.5;
219
  }
220
  .user-message {
221
+ background-color: var(--neutral-100);
222
+ border: 1px solid var(--neutral-200);
223
  }
224
  .assistant-message {
225
+ background-color: var(--primary-50);
226
+ border: 1px solid var(--primary-100);
227
+ }
228
+ .message-wrap {
229
+ max-width: 90%;
230
+ }
231
+ .chat-window {
232
+ height: 600px;
233
+ overflow-y: auto;
234
+ padding: 20px;
235
+ border-radius: 15px;
236
+ border: 1px solid var(--neutral-200);
237
+ background: var(--background-fill-primary);
238
  }
239
  footer {display: none !important;}
240
  .gradio-container {min-height: 100vh !important;}
241
+ .main {
242
+ flex-grow: 1;
243
+ padding: 2rem;
244
+ }
245
+ .message {
246
+ padding: 1rem;
247
+ margin: 0.5rem 0;
248
+ }
249
+ .avatar {
250
+ width: 40px;
251
+ height: 40px;
252
+ border-radius: 50%;
253
+ margin-right: 10px;
254
+ }
255
+ .timestamp {
256
+ font-size: 0.8rem;
257
+ color: var(--neutral-500);
258
+ }
259
  """
260
  ) as interface:
261
  gr.Markdown("""
 
279
 
280
  chatbot = gr.Chatbot(
281
  label="Chat History",
282
+ height=600,
283
  bubble_full_width=False,
284
  show_copy_button=True,
285
  render_markdown=True,
286
  container=True,
287
+ layout="bubble",
288
+ likeable=True,
289
+ avatar_images=["👤", "🤖"],
290
  elem_classes=["chat-window"],
291
+ type="messages",
292
+ show_label=False,
293
+ rtl=False,
294
  )
295
 
296
  with gr.Row():