Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -238,7 +238,6 @@ def _k2_model_candidates() -> List[str]:
|
|
| 238 |
"""
|
| 239 |
env_model = (os.getenv("KIMI_K2_MODEL") or "moonshotai/Kimi-K2-Instruct").strip()
|
| 240 |
candidates = [env_model]
|
| 241 |
-
# de-dupe while preserving order
|
| 242 |
seen = set()
|
| 243 |
out = []
|
| 244 |
for c in candidates:
|
|
@@ -422,6 +421,11 @@ def generate_wrapped_report(profile: gr.OAuthProfile) -> str:
|
|
| 422 |
<style>
|
| 423 |
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;600;700;800&display=swap');
|
| 424 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 425 |
body {{
|
| 426 |
font-family: 'Poppins', sans-serif;
|
| 427 |
background: linear-gradient(135deg, #FFF4D6 0%, #FFE6B8 50%, #FFF9E6 100%);
|
|
@@ -514,6 +518,17 @@ def generate_wrapped_report(profile: gr.OAuthProfile) -> str:
|
|
| 514 |
min-height: 170px;
|
| 515 |
}}
|
| 516 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 517 |
.stat-card:nth-child(1) {{ animation-delay: 0.1s; }}
|
| 518 |
.stat-card:nth-child(2) {{ animation-delay: 0.2s; }}
|
| 519 |
.stat-card:nth-child(3) {{ animation-delay: 0.3s; }}
|
|
@@ -768,7 +783,7 @@ def generate_wrapped_report(profile: gr.OAuthProfile) -> str:
|
|
| 768 |
</div>
|
| 769 |
|
| 770 |
<div class="section">
|
| 771 |
-
<h2
|
| 772 |
{f'''
|
| 773 |
<div class="item">
|
| 774 |
<div class="item-name"><span class="emoji">π€</span>{_repo_id(most_liked_model)}</div>
|
|
@@ -778,7 +793,7 @@ def generate_wrapped_report(profile: gr.OAuthProfile) -> str:
|
|
| 778 |
</div>
|
| 779 |
|
| 780 |
<div class="section">
|
| 781 |
-
<h2
|
| 782 |
{f'''
|
| 783 |
<div class="item">
|
| 784 |
<div class="item-name"><span class="emoji">π</span>{_repo_id(most_liked_dataset)}</div>
|
|
@@ -788,7 +803,7 @@ def generate_wrapped_report(profile: gr.OAuthProfile) -> str:
|
|
| 788 |
</div>
|
| 789 |
|
| 790 |
<div class="section">
|
| 791 |
-
<h2
|
| 792 |
{f'''
|
| 793 |
<div class="item">
|
| 794 |
<div class="item-name"><span class="emoji">π</span>{_repo_id(most_liked_space)}</div>
|
|
@@ -799,8 +814,8 @@ def generate_wrapped_report(profile: gr.OAuthProfile) -> str:
|
|
| 799 |
|
| 800 |
<div class="footer">
|
| 801 |
<p>π Thank you for being part of the Hugging Face community! π</p>
|
| 802 |
-
<p>Keep building amazing things in 2026
|
| 803 |
-
<p>Built with Inference Providers with
|
| 804 |
</div>
|
| 805 |
</div>
|
| 806 |
</body>
|
|
@@ -842,14 +857,10 @@ with gr.Blocks(theme=gr.themes.Soft(), css="""
|
|
| 842 |
output = gr.HTML(value=show_login_message())
|
| 843 |
|
| 844 |
def _render(profile_obj: Optional[gr.OAuthProfile] = None):
|
| 845 |
-
# In Gradio versions that support OAuth, `profile_obj` is injected after login.
|
| 846 |
return generate_wrapped_report(profile_obj) if profile_obj is not None else show_login_message()
|
| 847 |
|
| 848 |
-
# On load show the login message (and in some Gradio versions, this also receives the injected profile)
|
| 849 |
demo.load(fn=_render, inputs=None, outputs=output)
|
| 850 |
|
| 851 |
-
# After login completes, clicking the login button will trigger a rerender.
|
| 852 |
-
# Older Gradio treats LoginButton as a button (click event), not a value component (change event).
|
| 853 |
if hasattr(login_button, "click"):
|
| 854 |
login_button.click(fn=_render, inputs=None, outputs=output)
|
| 855 |
|
|
|
|
| 238 |
"""
|
| 239 |
env_model = (os.getenv("KIMI_K2_MODEL") or "moonshotai/Kimi-K2-Instruct").strip()
|
| 240 |
candidates = [env_model]
|
|
|
|
| 241 |
seen = set()
|
| 242 |
out = []
|
| 243 |
for c in candidates:
|
|
|
|
| 421 |
<style>
|
| 422 |
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;600;700;800&display=swap');
|
| 423 |
|
| 424 |
+
:root {{
|
| 425 |
+
/* Keep the report readable even if the HF host page is in dark mode */
|
| 426 |
+
color-scheme: light;
|
| 427 |
+
}}
|
| 428 |
+
|
| 429 |
body {{
|
| 430 |
font-family: 'Poppins', sans-serif;
|
| 431 |
background: linear-gradient(135deg, #FFF4D6 0%, #FFE6B8 50%, #FFF9E6 100%);
|
|
|
|
| 518 |
min-height: 170px;
|
| 519 |
}}
|
| 520 |
|
| 521 |
+
/* Force fixed readable colors (HF dark mode can override otherwise) */
|
| 522 |
+
.stat-card, .stat-card * {{
|
| 523 |
+
color: #111 !important;
|
| 524 |
+
}}
|
| 525 |
+
.stat-number {{
|
| 526 |
+
color: #111 !important;
|
| 527 |
+
}}
|
| 528 |
+
.stat-label {{
|
| 529 |
+
color: #111 !important;
|
| 530 |
+
}}
|
| 531 |
+
|
| 532 |
.stat-card:nth-child(1) {{ animation-delay: 0.1s; }}
|
| 533 |
.stat-card:nth-child(2) {{ animation-delay: 0.2s; }}
|
| 534 |
.stat-card:nth-child(3) {{ animation-delay: 0.3s; }}
|
|
|
|
| 783 |
</div>
|
| 784 |
|
| 785 |
<div class="section">
|
| 786 |
+
<h2>Most Liked Model</h2>
|
| 787 |
{f'''
|
| 788 |
<div class="item">
|
| 789 |
<div class="item-name"><span class="emoji">π€</span>{_repo_id(most_liked_model)}</div>
|
|
|
|
| 793 |
</div>
|
| 794 |
|
| 795 |
<div class="section">
|
| 796 |
+
<h2>Most Liked Dataset</h2>
|
| 797 |
{f'''
|
| 798 |
<div class="item">
|
| 799 |
<div class="item-name"><span class="emoji">π</span>{_repo_id(most_liked_dataset)}</div>
|
|
|
|
| 803 |
</div>
|
| 804 |
|
| 805 |
<div class="section">
|
| 806 |
+
<h2>Most Liked Space</h2>
|
| 807 |
{f'''
|
| 808 |
<div class="item">
|
| 809 |
<div class="item-name"><span class="emoji">π</span>{_repo_id(most_liked_space)}</div>
|
|
|
|
| 814 |
|
| 815 |
<div class="footer">
|
| 816 |
<p>π Thank you for being part of the Hugging Face community! π</p>
|
| 817 |
+
<p>Keep building amazing things in 2026!</p>
|
| 818 |
+
<p>Built with Inference Providers with π</p>
|
| 819 |
</div>
|
| 820 |
</div>
|
| 821 |
</body>
|
|
|
|
| 857 |
output = gr.HTML(value=show_login_message())
|
| 858 |
|
| 859 |
def _render(profile_obj: Optional[gr.OAuthProfile] = None):
|
|
|
|
| 860 |
return generate_wrapped_report(profile_obj) if profile_obj is not None else show_login_message()
|
| 861 |
|
|
|
|
| 862 |
demo.load(fn=_render, inputs=None, outputs=output)
|
| 863 |
|
|
|
|
|
|
|
| 864 |
if hasattr(login_button, "click"):
|
| 865 |
login_button.click(fn=_render, inputs=None, outputs=output)
|
| 866 |
|