Spaces:
Running on Zero
Running on Zero
Upload app.py with huggingface_hub
Browse files
app.py
CHANGED
|
@@ -304,6 +304,8 @@ EXAMPLES_QA = [
|
|
| 304 |
# Inference functions
|
| 305 |
# ---------------------------------------------------------------------------
|
| 306 |
ZEROGPU_QUEUE_HINT = "No GPU was available after"
|
|
|
|
|
|
|
| 307 |
|
| 308 |
|
| 309 |
def _is_zerogpu_queue_timeout(err: Exception) -> bool:
|
|
@@ -336,8 +338,8 @@ def classify(description: str, api_key: str, request: gr.Request | None = None)
|
|
| 336 |
return json.dumps(
|
| 337 |
{
|
| 338 |
"error": (
|
| 339 |
-
"Please
|
| 340 |
-
"ZeroGPU quota is per logged-in user."
|
| 341 |
)
|
| 342 |
},
|
| 343 |
indent=2,
|
|
@@ -387,8 +389,8 @@ def ask(question: str, api_key: str, request: gr.Request | None = None) -> str:
|
|
| 387 |
return "*Please enter a question.*"
|
| 388 |
if IS_SPACES and not _spaces_user_logged_in(request):
|
| 389 |
return (
|
| 390 |
-
"**Error:** Please
|
| 391 |
-
"ZeroGPU quota is per logged-in user."
|
| 392 |
)
|
| 393 |
|
| 394 |
use_hf = _use_hf_model()
|
|
@@ -571,11 +573,11 @@ def build_app() -> gr.Blocks:
|
|
| 571 |
""")
|
| 572 |
with gr.Row():
|
| 573 |
gr.Markdown(
|
| 574 |
-
"**Required:**
|
| 575 |
"counts against your account quota."
|
| 576 |
)
|
| 577 |
gr.HTML(
|
| 578 |
-
'<a href="
|
| 579 |
'style="display:inline-block;padding:10px 14px;border-radius:8px;'
|
| 580 |
'background:#2563eb;color:#fff;text-decoration:none;font-weight:600;">'
|
| 581 |
"Sign in with Hugging Face</a>"
|
|
|
|
| 304 |
# Inference functions
|
| 305 |
# ---------------------------------------------------------------------------
|
| 306 |
ZEROGPU_QUEUE_HINT = "No GPU was available after"
|
| 307 |
+
SPACES_PAGE_URL = "https://huggingface.co/spaces/vibesecurityguy/veris-classifier"
|
| 308 |
+
HF_LOGIN_URL = "https://huggingface.co/login?next=%2Fspaces%2Fvibesecurityguy%2Fveris-classifier"
|
| 309 |
|
| 310 |
|
| 311 |
def _is_zerogpu_queue_timeout(err: Exception) -> bool:
|
|
|
|
| 338 |
return json.dumps(
|
| 339 |
{
|
| 340 |
"error": (
|
| 341 |
+
"Please log in on Hugging Face and open this app from "
|
| 342 |
+
f"{SPACES_PAGE_URL}. ZeroGPU quota is per logged-in user."
|
| 343 |
)
|
| 344 |
},
|
| 345 |
indent=2,
|
|
|
|
| 389 |
return "*Please enter a question.*"
|
| 390 |
if IS_SPACES and not _spaces_user_logged_in(request):
|
| 391 |
return (
|
| 392 |
+
"**Error:** Please log in on Hugging Face and open this app from "
|
| 393 |
+
f"{SPACES_PAGE_URL}. ZeroGPU quota is per logged-in user."
|
| 394 |
)
|
| 395 |
|
| 396 |
use_hf = _use_hf_model()
|
|
|
|
| 573 |
""")
|
| 574 |
with gr.Row():
|
| 575 |
gr.Markdown(
|
| 576 |
+
"**Required:** Log in with Hugging Face so ZeroGPU usage "
|
| 577 |
"counts against your account quota."
|
| 578 |
)
|
| 579 |
gr.HTML(
|
| 580 |
+
f'<a href="{HF_LOGIN_URL}" target="_self" '
|
| 581 |
'style="display:inline-block;padding:10px 14px;border-radius:8px;'
|
| 582 |
'background:#2563eb;color:#fff;text-decoration:none;font-weight:600;">'
|
| 583 |
"Sign in with Hugging Face</a>"
|