csabakecskemeti commited on
Commit
549d679
·
verified ·
1 Parent(s): 1168d76

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +22 -21
app.py CHANGED
@@ -348,38 +348,39 @@ def generate_response(message: str, history: List[List[str]], system_prompt: str
348
 
349
  # CSS to fix avatar distortion and positioning issues
350
  avatar_css = """
351
- /* Fix avatar image distortion and positioning */
352
- .avatar-container img {
 
 
 
 
 
353
  width: 40px !important;
354
  height: 40px !important;
 
 
 
 
355
  border-radius: 50% !important;
356
  object-fit: cover !important;
 
357
  margin: 0px !important;
358
  padding: 0px !important;
359
  display: block !important;
 
360
  }
361
 
362
- /* Fix message row positioning */
363
- .message-row img {
364
- margin: 0px !important;
365
- padding: 0px !important;
366
- }
367
-
368
- /* Additional fix for Gradio v5 centering issues */
369
- .message img {
370
  width: 40px !important;
371
  height: 40px !important;
372
- border-radius: 50% !important;
373
- object-fit: cover !important;
374
- margin: 0px !important;
375
- padding: 0px !important;
376
- }
377
-
378
- /* Ensure proper aspect ratio for all chatbot images */
379
- #chatbot img {
380
- aspect-ratio: 1 !important;
381
- object-fit: cover !important;
382
- border-radius: 50% !important;
383
  }
384
  """
385
 
 
348
 
349
  # CSS to fix avatar distortion and positioning issues
350
  avatar_css = """
351
+ /* Fix avatar image distortion with multiple selectors for compatibility */
352
+ #chatbot .avatar-container img,
353
+ #chatbot .message-row img,
354
+ #chatbot .message img,
355
+ #chatbot img[src*="twemoji"],
356
+ #chatbot img[src*="huggingface"],
357
+ .gr-chatbot img {
358
  width: 40px !important;
359
  height: 40px !important;
360
+ min-width: 40px !important;
361
+ min-height: 40px !important;
362
+ max-width: 40px !important;
363
+ max-height: 40px !important;
364
  border-radius: 50% !important;
365
  object-fit: cover !important;
366
+ aspect-ratio: 1 / 1 !important;
367
  margin: 0px !important;
368
  padding: 0px !important;
369
  display: block !important;
370
+ flex-shrink: 0 !important;
371
  }
372
 
373
+ /* Force square containers */
374
+ #chatbot .avatar-container,
375
+ .gr-chatbot .avatar-container {
 
 
 
 
 
376
  width: 40px !important;
377
  height: 40px !important;
378
+ min-width: 40px !important;
379
+ min-height: 40px !important;
380
+ flex-shrink: 0 !important;
381
+ display: flex !important;
382
+ align-items: center !important;
383
+ justify-content: center !important;
 
 
 
 
 
384
  }
385
  """
386