ahans1 hysts HF staff commited on
Commit
3474707
1 Parent(s): 1008577

- Update for ZeroGPU (693a000cdff0d4d18a6c61b0b000776cdfe0be70)


Co-authored-by: hysts <hysts@users.noreply.huggingface.co>

Files changed (1) hide show
  1. demo/demo.py +2 -0
demo/demo.py CHANGED
@@ -1,6 +1,7 @@
1
  __all__ = ["app"]
2
 
3
  import gradio as gr
 
4
  from binoculars import Binoculars
5
 
6
  BINO = Binoculars()
@@ -12,6 +13,7 @@ def count_tokens(text):
12
  return len(TOKENIZER(text).input_ids)
13
 
14
 
 
15
  def run_detector(input_str):
16
  if count_tokens(input_str) < MINIMUM_TOKENS:
17
  gr.Warning(f"Too short length. Need minimum {MINIMUM_TOKENS} tokens to run Binoculars.")
 
1
  __all__ = ["app"]
2
 
3
  import gradio as gr
4
+ import spaces
5
  from binoculars import Binoculars
6
 
7
  BINO = Binoculars()
 
13
  return len(TOKENIZER(text).input_ids)
14
 
15
 
16
+ @spaces.GPU
17
  def run_detector(input_str):
18
  if count_tokens(input_str) < MINIMUM_TOKENS:
19
  gr.Warning(f"Too short length. Need minimum {MINIMUM_TOKENS} tokens to run Binoculars.")