Spaces:
Sleeping
Sleeping
File size: 770 Bytes
7ee2ab0 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | import gradio as gr
from hf_utils import _count_submissions_today, _get_cap_for_phase
def get_user_greeting(profile: gr.OAuthProfile | None) -> str:
if profile is None:
return "👋 Log in with your HuggingFace account to submit predictions."
return f"👤 Logged in as **{profile.username}**"
def get_daily_cap_info(profile: gr.OAuthProfile | None, phases: list = None) -> str:
if profile is None:
return ""
lines = []
for p in phases or []:
cap = _get_cap_for_phase(p["codename"])
used = _count_submissions_today(profile.username, p["codename"])
remaining = cap - used
lines.append(f"**{p['label'].split('(')[0].strip()}:** {remaining}/{cap} remaining")
return " \n".join(lines)
|