haepada commited on
Commit
4709eba
·
verified ·
1 Parent(s): 541e490

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +58 -36
app.py CHANGED
@@ -586,9 +586,33 @@ def create_interface():
586
  "final_prompt": "",
587
  "image_path": None,
588
  "current_tab": 0,
589
- "audio_playing": False # 오디오 상태 추가
590
  }
591
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
592
  # HTML5 Audio Player 템플릿
593
  AUDIO_PLAYER_HTML = """
594
  <div class="audio-player-container">
@@ -634,26 +658,6 @@ def create_interface():
634
  alert("음악 파일을 불러오는데 실패했습니다. 페이지를 새로고침해주세요.");
635
  });
636
  </script>
637
- <style>
638
- .custom-audio-button {
639
- width: 100%;
640
- padding: 10px;
641
- margin: 10px 0;
642
- background-color: #4a90e2;
643
- color: white;
644
- border: none;
645
- border-radius: 5px;
646
- cursor: pointer;
647
- font-size: 16px;
648
- }
649
- .custom-audio-button:active {
650
- background-color: #357abd;
651
- }
652
- .audio-player-container {
653
- margin: 20px 0;
654
- width: 100%;
655
- }
656
- </style>
657
  """
658
 
659
  css = """
@@ -663,29 +667,47 @@ def create_interface():
663
  padding: 0 !important;
664
  }
665
 
666
- .audio-container {
667
- margin: 20px 0;
668
- width: 100%;
669
- }
670
-
671
  /* 모바일 최적화 */
672
  @media (max-width: 600px) {
 
 
 
 
 
 
 
 
 
 
 
 
673
  .gradio-button {
674
- min-height: 44px !important; /* iOS 터치 타겟 사이즈 */
675
  margin: 10px 0 !important;
676
  }
677
-
678
- .container {
679
- padding: 10px !important;
680
- }
681
-
682
- /* 입력 필드 최적화 */
683
- input[type="text"],
684
- textarea {
685
- font-size: 16px !important; /* iOS auto-zoom 방지 */
686
  padding: 12px !important;
687
  }
688
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
689
  """
690
 
691
  with gr.Blocks(theme=gr.themes.Soft(), css=css) as app:
 
586
  "final_prompt": "",
587
  "image_path": None,
588
  "current_tab": 0,
589
+ "audio_playing": False
590
  }
591
 
592
+ def encode_image_to_base64(image_path):
593
+ try:
594
+ with open(image_path, "rb") as img_file:
595
+ return base64.b64encode(img_file.read()).decode()
596
+ except Exception as e:
597
+ print(f"이미지 로딩 에러 ({image_path}): {e}")
598
+ return ""
599
+
600
+ # 로고 이미지 인코딩
601
+ mobile_logo = encode_image_to_base64("static/DIGITAL_GUTPAN_LOGO_m.png")
602
+ desktop_logo = encode_image_to_base64("static/DIGITAL_GUTPAN_LOGO_w.png")
603
+
604
+ if not mobile_logo or not desktop_logo:
605
+ logo_html = """
606
+ <div style="text-align: center; padding: 20px;">
607
+ <h1 style="font-size: 24px;">디지털 굿판</h1>
608
+ </div>
609
+ """
610
+ else:
611
+ logo_html = f"""
612
+ <img class="mobile-logo" src="data:image/png;base64,{mobile_logo}" alt="디지털 굿판 로고 모바일">
613
+ <img class="desktop-logo" src="data:image/png;base64,{desktop_logo}" alt="디지털 굿판 로고 데스크톱">
614
+ """
615
+
616
  # HTML5 Audio Player 템플릿
617
  AUDIO_PLAYER_HTML = """
618
  <div class="audio-player-container">
 
658
  alert("음악 파일을 불러오는데 실패했습니다. 페이지를 새로고침해주세요.");
659
  });
660
  </script>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
661
  """
662
 
663
  css = """
 
667
  padding: 0 !important;
668
  }
669
 
 
 
 
 
 
670
  /* 모바일 최적화 */
671
  @media (max-width: 600px) {
672
+ .logo-container {
673
+ padding: 20px 10px !important;
674
+ width: 100% !important;
675
+ }
676
+ .desktop-logo { display: none !important; }
677
+ .mobile-logo {
678
+ width: 100% !important;
679
+ height: auto !important;
680
+ max-width: 300px !important;
681
+ margin: 0 auto !important;
682
+ display: block !important;
683
+ }
684
  .gradio-button {
685
+ min-height: 44px !important;
686
  margin: 10px 0 !important;
687
  }
688
+ input[type="text"], textarea {
689
+ font-size: 16px !important;
 
 
 
 
 
 
 
690
  padding: 12px !important;
691
  }
692
  }
693
+
694
+ /* 데스크톱 뷰 */
695
+ @media (min-width: 601px) {
696
+ .logo-container {
697
+ padding: 20px 0;
698
+ width: 100%;
699
+ max-width: 800px;
700
+ margin: 0 auto;
701
+ }
702
+ .mobile-logo { display: none !important; }
703
+ .desktop-logo {
704
+ width: 100%;
705
+ height: auto;
706
+ max-width: 800px;
707
+ margin: 0 auto;
708
+ display: block;
709
+ }
710
+ }
711
  """
712
 
713
  with gr.Blocks(theme=gr.themes.Soft(), css=css) as app: