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)