jamino30 commited on
Commit
d47ab59
1 Parent(s): 7341e32

Upload folder using huggingface_hub

Browse files
Files changed (1) hide show
  1. app.py +2 -6
app.py CHANGED
@@ -16,11 +16,7 @@ def tokenize(text, checked):
16
  colored_tokens = []
17
 
18
  for i, token in enumerate(tokens):
19
- if checked:
20
- ws_val = '⋅'
21
- else:
22
- ws_val = ' '
23
- token = tk.vocab[token].decode('utf-8').replace(' ', ws_val)
24
  span = f'<span style="background-color: {colors[i % len(colors)]}">{token}</span>'
25
  colored_tokens.append(span)
26
 
@@ -48,4 +44,4 @@ interface = gr.Interface(
48
  show_progress='hidden',
49
  api_name='tokenize',
50
  allow_flagging='never'
51
- ).launch()
 
16
  colored_tokens = []
17
 
18
  for i, token in enumerate(tokens):
19
+ token = tk.vocab[token].decode('utf-8').replace(' ', '⋅' if checked else '&nbsp;')
 
 
 
 
20
  span = f'<span style="background-color: {colors[i % len(colors)]}">{token}</span>'
21
  colored_tokens.append(span)
22
 
 
44
  show_progress='hidden',
45
  api_name='tokenize',
46
  allow_flagging='never'
47
+ ).launch(inbrowser=True)