Fix astro link: route via huggingface.co space page
Browse files
README.md
CHANGED
|
@@ -8,7 +8,7 @@ sdk_version: 6.25.0
|
|
| 8 |
app_file: app.py
|
| 9 |
pinned: false
|
| 10 |
license: mit
|
| 11 |
-
short_description: Create polls and vote
|
| 12 |
hf_oauth: true
|
| 13 |
# NOTE: Uncomment the line below to hard-gate the entire Space at the
|
| 14 |
# platform level so only slmconsortium members can even open it.
|
|
|
|
| 8 |
app_file: app.py
|
| 9 |
pinned: false
|
| 10 |
license: mit
|
| 11 |
+
short_description: Create polls and vote — members only
|
| 12 |
hf_oauth: true
|
| 13 |
# NOTE: Uncomment the line below to hard-gate the entire Space at the
|
| 14 |
# platform level so only slmconsortium members can even open it.
|
app.py
CHANGED
|
@@ -422,13 +422,19 @@ def on_load(
|
|
| 422 |
|
| 423 |
# ------------------------------------------------------------------ blocks
|
| 424 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 425 |
with gr.Blocks(title="SLM Consortium Polls") as demo:
|
| 426 |
gr.Markdown(
|
| 427 |
"# 🗳️ SLM Consortium Polls\n"
|
| 428 |
"Create polls and vote. **Sign-in with Hugging Face is required**, and only "
|
| 429 |
f"members of the `{REQUIRED_ORG}` organization can create polls or vote. "
|
| 430 |
"Everyone can view live results.\n\n"
|
| 431 |
-
"Prefer the new look? Use the [Astro frontend](
|
| 432 |
)
|
| 433 |
with gr.Row():
|
| 434 |
gr.LoginButton(min_width=50)
|
|
|
|
| 422 |
|
| 423 |
# ------------------------------------------------------------------ blocks
|
| 424 |
|
| 425 |
+
# Link for reaching the Astro frontend from the gradio UI. On a private
|
| 426 |
+
# Space a bare "/" (hf.space root) 404s in a fresh tab — the HF auth
|
| 427 |
+
# handshake only happens via the huggingface.co Space page.
|
| 428 |
+
_space_id = os.getenv("SPACE_ID", "")
|
| 429 |
+
_astro_link = f"https://huggingface.co/spaces/{_space_id}" if _space_id else "/"
|
| 430 |
+
|
| 431 |
with gr.Blocks(title="SLM Consortium Polls") as demo:
|
| 432 |
gr.Markdown(
|
| 433 |
"# 🗳️ SLM Consortium Polls\n"
|
| 434 |
"Create polls and vote. **Sign-in with Hugging Face is required**, and only "
|
| 435 |
f"members of the `{REQUIRED_ORG}` organization can create polls or vote. "
|
| 436 |
"Everyone can view live results.\n\n"
|
| 437 |
+
f"Prefer the new look? Use the [Astro frontend]({_astro_link}) at the Space root."
|
| 438 |
)
|
| 439 |
with gr.Row():
|
| 440 |
gr.LoginButton(min_width=50)
|