sadgaj commited on
Commit
49558d5
·
verified ·
1 Parent(s): 0b4c72e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -15
app.py CHANGED
@@ -1,27 +1,19 @@
1
  import gradio as gr
2
- from binoculars import Binoculars
3
-
4
- BINO = Binoculars()
5
- TOKENIZER = BINO.tokenizer
6
- MINIMUM_TOKENS = 64
7
 
8
 
9
  def count_tokens(text):
10
- return len(TOKENIZER(text).input_ids)
 
11
 
12
 
13
  def run_detector(input_str):
14
- if count_tokens(input_str) < MINIMUM_TOKENS:
15
- gr.Warning(f"Too short length. Need minimum {MINIMUM_TOKENS} tokens to run Binoculars.")
16
- return ""
17
- return f"{BINO.predict(input_str)}"
 
18
 
19
 
20
- # def load_set(progress=gr.Progress()):
21
- # tokens = [None] * 24
22
- # for count in progress.tqdm(tokens, desc="Counting Tokens..."):
23
- # time.sleep(0.01)
24
- # return ["Loaded"] * 2
25
 
26
 
27
  css = """
 
1
  import gradio as gr
 
 
 
 
 
2
 
3
 
4
  def count_tokens(text):
5
+ return 0
6
+ # return len(TOKENIZER(text).input_ids)
7
 
8
 
9
  def run_detector(input_str):
10
+ return 1
11
+ # if count_tokens(input_str) < MINIMUM_TOKENS:
12
+ # gr.Warning(f"Too short length. Need minimum {MINIMUM_TOKENS} tokens to run Binoculars.")
13
+ # return ""
14
+ # return f"{BINO.predict(input_str)}"
15
 
16
 
 
 
 
 
 
17
 
18
 
19
  css = """