QIDNLF commited on
Commit
51d6641
·
verified ·
1 Parent(s): 41a50d7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +29 -31
app.py CHANGED
@@ -22,15 +22,14 @@ def blob_to_base64_html(blob_data):
22
  try:
23
  if isinstance(blob_data, (bytes, bytearray)):
24
  encoded = base64.b64encode(blob_data).decode('utf-8')
25
-
26
- return f'''
27
- <img src="data:image/png;base64,{encoded}"
28
- style="width: 50%; max-height: 400px; object-fit: contain;
29
- cursor: zoom-in; border: 1px solid #ccc; border-radius: 4px;
30
- padding: 2px; background-color: white; margin: 5px 0; display: block;"
31
- onclick="window.open(this.src)">
32
- '''
33
-
34
  return str(blob_data)
35
  except Exception as e:
36
  return str(blob_data)
@@ -665,29 +664,28 @@ table th:nth-child(6):nth-last-child(1), table td:nth-child(6):nth-last-child(1)
665
  /* -------------------------- */
666
  /* 기본 테이블 & 스크롤 설정 */
667
  /* -------------------------- */
668
- thead th {
669
- font-size: 18px !important;
670
- position: sticky;
671
- top: 0;
672
- background: white;
673
- z-index: 10;
674
- }
675
- .dataframe {
676
- max-height: none !important;
677
- overflow-y: visible !important;
678
- }
679
- .dataframe > div {
680
- max-height: none !important;
681
- overflow: visible !important;
682
- }
683
- td {
684
- font-size: 18px !important;
685
- white-space: pre-wrap !important;
686
- word-break: break-word !important;
687
- line-height: 1.6;
688
- padding: 10px;
689
  vertical-align: top !important;
690
- }
 
 
 
 
 
 
 
 
 
 
 
 
691
 
692
  """
693
  if __name__ == "__main__":
 
22
  try:
23
  if isinstance(blob_data, (bytes, bytearray)):
24
  encoded = base64.b64encode(blob_data).decode('utf-8')
25
+ # 💡 [핵심] img를 1200px짜리 div로 강제로 감싸서 Gradio가 못 건드리게 합니다.
26
+ # width: 1200px !important 를 사용하여 어떤 상황에서도 크게 만듭니다.
27
+ return f"""
28
+ <div style="width: 1200px !important; margin: 10px 0;">
29
+ <img src='data:image/png;base64,{encoded}'
30
+ style='width: 100% !important; height: auto !important; display: block; border: 1px solid #ddd;' />
31
+ </div>
32
+ """
 
33
  return str(blob_data)
34
  except Exception as e:
35
  return str(blob_data)
 
664
  /* -------------------------- */
665
  /* 기본 테이블 & 스크롤 설정 */
666
  /* -------------------------- */
667
+ .dataframe {
668
+ display: block !important;
669
+ overflow-x: auto !important;
670
+ white-space: nowrap !important;
671
+ }
672
+
673
+ /* 2. 모든 셀 상단 정렬 (이게 적용되어야 번호가 맨 위에 붙습니다) */
674
+ .dataframe td {
 
 
 
 
 
 
 
 
 
 
 
 
 
675
  vertical-align: top !important;
676
+ padding: 15px !important;
677
+ white-space: normal !important; /* 글자는 자동 줄바꿈 허용 */
678
+ }
679
+
680
+ /* 3. 이미지 칸(Description)이 너무 좁아지지 않게 방어 */
681
+ .dataframe td:nth-child(2) {
682
+ min-width: 1250px !important;
683
+ }
684
+
685
+ /* 4. Gradio 기본 이미지 제한 해제 */
686
+ .dataframe img {
687
+ max-width: none !important;
688
+ }
689
 
690
  """
691
  if __name__ == "__main__":