Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -12,17 +12,15 @@ from supabase import create_client, Client
|
|
| 12 |
url: str = os.environ.get("SUPABASE_URL")
|
| 13 |
key: str = os.environ.get("SUPABASE_KEY")
|
| 14 |
supabase: Client = create_client(url, key)
|
| 15 |
-
print(supabase)
|
| 16 |
|
| 17 |
def load_registered_teams():
|
| 18 |
result = supabase.table("teams").select("*").execute()
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
|
| 23 |
return {team["name"].casefold(): team["name"] for team in result.data}
|
| 24 |
|
| 25 |
-
REGISTERED_TEAMS = load_registered_teams()
|
| 26 |
|
| 27 |
INTRO_DEFAULT = "### The Safety Game 路 Prompt Submission\n"
|
| 28 |
INTRO_VERIFIED_TEMPLATE = (
|
|
@@ -89,7 +87,7 @@ def verify_team(team_name: str):
|
|
| 89 |
gr.update(value=INTRO_DEFAULT),
|
| 90 |
)
|
| 91 |
|
| 92 |
-
official_name =
|
| 93 |
|
| 94 |
if official_name:
|
| 95 |
return (
|
|
|
|
| 12 |
url: str = os.environ.get("SUPABASE_URL")
|
| 13 |
key: str = os.environ.get("SUPABASE_KEY")
|
| 14 |
supabase: Client = create_client(url, key)
|
|
|
|
| 15 |
|
| 16 |
def load_registered_teams():
|
| 17 |
result = supabase.table("teams").select("*").execute()
|
| 18 |
+
|
| 19 |
+
if not result or not result.data:
|
| 20 |
+
raise RuntimeError("An error occurred")
|
| 21 |
|
| 22 |
return {team["name"].casefold(): team["name"] for team in result.data}
|
| 23 |
|
|
|
|
| 24 |
|
| 25 |
INTRO_DEFAULT = "### The Safety Game 路 Prompt Submission\n"
|
| 26 |
INTRO_VERIFIED_TEMPLATE = (
|
|
|
|
| 87 |
gr.update(value=INTRO_DEFAULT),
|
| 88 |
)
|
| 89 |
|
| 90 |
+
official_name = load_registered_teams().get(team_name.casefold())
|
| 91 |
|
| 92 |
if official_name:
|
| 93 |
return (
|