Commit ·
d463761
1
Parent(s): b8f7c69
fix auth
Browse files- app.py +4 -4
- requirements.txt +4 -4
app.py
CHANGED
|
@@ -57,10 +57,10 @@ user_last_submission = {}
|
|
| 57 |
|
| 58 |
def submit_challenge(file, request: gr.Request):
|
| 59 |
# Check if the user is logged in via OAuth
|
| 60 |
-
|
|
|
|
| 61 |
raise gr.Error("Please 'Sign in with Hugging Face' at the top of the page to submit.")
|
| 62 |
|
| 63 |
-
user_name = request.username
|
| 64 |
user_key = f"{user_name}" # Use username as the unique key
|
| 65 |
|
| 66 |
# Rate Limiting (10 mins)
|
|
@@ -92,7 +92,7 @@ def submit_challenge(file, request: gr.Request):
|
|
| 92 |
return f"Error: {str(e)}", sync_leaderboard()
|
| 93 |
|
| 94 |
# --- UPDATED UI ---
|
| 95 |
-
with gr.Blocks(
|
| 96 |
gr.Markdown("# LLM Lipogram Challenge Portal")
|
| 97 |
|
| 98 |
# This displays a login button if the user is not authenticated
|
|
@@ -114,4 +114,4 @@ with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
|
| 114 |
outputs=[output_text, leaderboard_df]
|
| 115 |
)
|
| 116 |
|
| 117 |
-
demo.launch()
|
|
|
|
| 57 |
|
| 58 |
def submit_challenge(file, request: gr.Request):
|
| 59 |
# Check if the user is logged in via OAuth
|
| 60 |
+
user_name = request.username or request.session.get("username")
|
| 61 |
+
if not user_name:
|
| 62 |
raise gr.Error("Please 'Sign in with Hugging Face' at the top of the page to submit.")
|
| 63 |
|
|
|
|
| 64 |
user_key = f"{user_name}" # Use username as the unique key
|
| 65 |
|
| 66 |
# Rate Limiting (10 mins)
|
|
|
|
| 92 |
return f"Error: {str(e)}", sync_leaderboard()
|
| 93 |
|
| 94 |
# --- UPDATED UI ---
|
| 95 |
+
with gr.Blocks() as demo:
|
| 96 |
gr.Markdown("# LLM Lipogram Challenge Portal")
|
| 97 |
|
| 98 |
# This displays a login button if the user is not authenticated
|
|
|
|
| 114 |
outputs=[output_text, leaderboard_df]
|
| 115 |
)
|
| 116 |
|
| 117 |
+
demo.launch(theme=gr.themes.Soft())
|
requirements.txt
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
gradio
|
| 2 |
-
gradio-client
|
| 3 |
-
huggingface-hub
|
| 4 |
-
pandas
|
|
|
|
| 1 |
+
gradio>=4.41.0
|
| 2 |
+
gradio-client>=0.17.0
|
| 3 |
+
huggingface-hub>=0.23.0
|
| 4 |
+
pandas>=2.0.0
|