ginipick commited on
Commit
76fcc2b
·
verified ·
1 Parent(s): 4489850

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +27 -11
app.py CHANGED
@@ -721,18 +721,25 @@ with gr.Blocks(title="AI PROMPT ENHANCER") as demo:
721
  gr.HTML(f"""
722
  <style>{CUSTOM_CSS}</style>
723
  <script>
724
- // HuggingFace Spaces URL이면 커스텀 도메인으로 리다이렉트
725
- (function() {{
726
- const currentHost = window.location.hostname;
727
- const customDomain = '1street.ai';
728
-
729
- // huggingface.co 도메인이면 커스텀 도메인으로 리다이렉트
730
- if (currentHost.includes('huggingface.co') || currentHost.includes('hf.space')) {{
731
- const newUrl = 'https://' + customDomain + window.location.pathname + window.location.search;
732
- window.location.replace(newUrl);
 
 
 
 
733
  }}
734
- }})();
735
  </script>
 
 
 
736
  """)
737
 
738
  # 헤더 영역
@@ -745,7 +752,16 @@ with gr.Blocks(title="AI PROMPT ENHANCER") as demo:
745
  </div>
746
  ''')
747
  with gr.Column(scale=1, min_width=200):
748
- login_btn = gr.LoginButton(value="🤗 로그인", size="sm")
 
 
 
 
 
 
 
 
 
749
 
750
  # 유저 정보 표시
751
  user_status = gr.Markdown("")
 
721
  gr.HTML(f"""
722
  <style>{CUSTOM_CSS}</style>
723
  <script>
724
+ // 페이지 로드 즉시 실행
725
+ const currentHost = window.location.hostname;
726
+ const customDomain = '1street.ai';
727
+
728
+ // huggingface.co 또는 hf.space 도메인이면 커스텀 도메인으로 리다이렉트
729
+ if (currentHost.includes('huggingface.co') || currentHost.includes('hf.space')) {{
730
+ window.location.href = 'https://' + customDomain;
731
+ }}
732
+
733
+ // DOM 로드 후에도 체크
734
+ document.addEventListener('DOMContentLoaded', function() {{
735
+ if (window.location.hostname.includes('huggingface.co') || window.location.hostname.includes('hf.space')) {{
736
+ window.location.href = 'https://' + customDomain;
737
  }}
738
+ }});
739
  </script>
740
+ <noscript>
741
+ <meta http-equiv="refresh" content="0;url=https://1street.ai">
742
+ </noscript>
743
  """)
744
 
745
  # 헤더 영역
 
752
  </div>
753
  ''')
754
  with gr.Column(scale=1, min_width=200):
755
+ gr.HTML('''
756
+ <a href="/login/huggingface?_target_url=https://1street.ai"
757
+ style="display: inline-flex; align-items: center; gap: 8px;
758
+ background: linear-gradient(135deg, #ff9d00 0%, #ffb347 100%);
759
+ color: #000; font-weight: 600; font-size: 0.9rem;
760
+ padding: 10px 20px; border-radius: 25px; text-decoration: none;
761
+ box-shadow: 0 4px 12px rgba(255, 157, 0, 0.3);">
762
+ 🤗 로그인
763
+ </a>
764
+ ''')
765
 
766
  # 유저 정보 표시
767
  user_status = gr.Markdown("")