vimalprasad37 commited on
Commit
cf8de8d
·
1 Parent(s): 29eb48f

Feature update1

Browse files
Files changed (1) hide show
  1. app.py +41 -2
app.py CHANGED
@@ -704,8 +704,8 @@ def get_inference_duration(
704
  if safe_mode:
705
  total_time = total_time * 1.30
706
  print("time_before------", total_time)
707
- if duration_seconds >= 10:
708
- total_time = total_time - 54
709
  print("total_time-------", total_time)
710
  # ZeroGPU refuses a booking above its own ceiling outright, and `size="xlarge"` doubles what is
711
  # asked for, so a runaway estimate fails before it starts.
@@ -844,6 +844,12 @@ def run_inference(
844
  TELEGRAM_CONTACT = "@vmlhub"
845
  TELEGRAM_URL = "https://t.me/" + TELEGRAM_CONTACT.lstrip("@")
846
 
 
 
 
 
 
 
847
  # The handle as a clickable link with the Telegram mark in front of it. Inline SVG
848
  # rather than an emoji or an <img>: it renders identically everywhere, needs no
849
  # network fetch, and picks up the surrounding text colour.
@@ -3341,6 +3347,24 @@ label > span, .gradio-container .info, .gradio-container small { opacity: .95 !i
3341
  background: rgba(245, 158, 11, .12);
3342
  border: 1px solid rgba(245, 158, 11, .45);
3343
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3344
 
3345
  /* Inside the hero the text is white on purple, so the blue would disappear. */
3346
  #hero .tg-link { color: #fff; }
@@ -3435,6 +3459,21 @@ with gr.Blocks(delete_cache=(3600, 86400)) as demo:
3435
  "<div class='status-lock'><b>&#128274; Locked</b>"
3436
  f"<span>{BUY_LINK} &mdash; or message Telegram {TELEGRAM_LINK}</span></div>"
3437
  )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3438
  gr.HTML(
3439
  "<div class='gpu-notice'><b>&#9888;&#65039; Important: the key unlocks features, "
3440
  "not extra GPU time.</b> Generation runs on Hugging Face ZeroGPU, and the GPU "
 
704
  if safe_mode:
705
  total_time = total_time * 1.30
706
  print("time_before------", total_time)
707
+ if duration_seconds >= 8:
708
+ total_time = total_time - 40
709
  print("total_time-------", total_time)
710
  # ZeroGPU refuses a booking above its own ceiling outright, and `size="xlarge"` doubles what is
711
  # asked for, so a runaway estimate fails before it starts.
 
844
  TELEGRAM_CONTACT = "@vmlhub"
845
  TELEGRAM_URL = "https://t.me/" + TELEGRAM_CONTACT.lstrip("@")
846
 
847
+ # Where an anonymous visitor is sent to raise their ZeroGPU quota. Signed out,
848
+ # spaces.zero.client tracks usage by IP address (see client.py:134, "Falling
849
+ # back to IP-based quotas") rather than per person, so it is the smallest
850
+ # allowance there is and it is shared with anyone on the same network.
851
+ SIGNUP_URL = "https://huggingface.co/join"
852
+
853
  # The handle as a clickable link with the Telegram mark in front of it. Inline SVG
854
  # rather than an emoji or an <img>: it renders identically everywhere, needs no
855
  # network fetch, and picks up the surrounding text colour.
 
3347
  background: rgba(245, 158, 11, .12);
3348
  border: 1px solid rgba(245, 158, 11, .45);
3349
  }
3350
+ /* Blue, distinct from the amber quota notice below it - this one is an action
3351
+ to take, not a limitation to accept. */
3352
+ .signin-note {
3353
+ margin: 10px 0 0;
3354
+ border-radius: 12px;
3355
+ padding: 11px 14px;
3356
+ font-size: var(--fs-sm);
3357
+ line-height: 1.6;
3358
+ background: rgba(37, 99, 235, .10);
3359
+ border: 1px solid rgba(37, 99, 235, .35);
3360
+ }
3361
+ .signin-link {
3362
+ display: inline-flex; align-items: center;
3363
+ padding: 2px 10px; border-radius: 999px;
3364
+ background: #2563eb; color: #fff !important;
3365
+ font-weight: 700; text-decoration: none; white-space: nowrap;
3366
+ }
3367
+ .signin-link:hover { background: #1d4ed8; text-decoration: none; }
3368
 
3369
  /* Inside the hero the text is white on purple, so the blue would disappear. */
3370
  #hero .tg-link { color: #fff; }
 
3459
  "<div class='status-lock'><b>&#128274; Locked</b>"
3460
  f"<span>{BUY_LINK} &mdash; or message Telegram {TELEGRAM_LINK}</span></div>"
3461
  )
3462
+ # Directly under the key box on purpose. GPU quota is charged to the
3463
+ # viewer, and an anonymous visitor is metered by IP address - so one
3464
+ # shared network or a CGNAT range is one allowance between everybody on
3465
+ # it. A buyer who never signs in gets the smallest quota there is and
3466
+ # reads it as the key being faulty, which arrives as a support message.
3467
+ gr.HTML(
3468
+ "<div class='signin-note'>&#128100; <b>Sign in to Hugging Face before you "
3469
+ "generate.</b> It is free, takes a moment, and is the single biggest thing you "
3470
+ "can do to get more out of your key. Signed out, your GPU allowance is counted "
3471
+ "against your <b>IP address</b> &mdash; shared with anyone else on the same "
3472
+ "network &mdash; and it is the smallest allowance there is. "
3473
+ f"<a href='{SIGNUP_URL}' target='_blank' rel='noopener noreferrer' "
3474
+ "class='signin-link'>Create a free account</a> or sign in, then reload this "
3475
+ "page.</div>"
3476
+ )
3477
  gr.HTML(
3478
  "<div class='gpu-notice'><b>&#9888;&#65039; Important: the key unlocks features, "
3479
  "not extra GPU time.</b> Generation runs on Hugging Face ZeroGPU, and the GPU "