evaluationServer / auth_utils.py
NidhiS09's picture
Restructure for challenges
7ee2ab0
Raw
History Blame Contribute Delete
770 Bytes
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)