yeshpanovrustem commited on
Commit
6fb6ead
1 Parent(s): a4366fd

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -1,5 +1,5 @@
1
  from annotated_text import annotated_text, parameters, annotation
2
- from nltk.tokenize import word_tokenize
3
  from transformers import AutoTokenizer, AutoModelForTokenClassification, pipeline
4
  import streamlit as st
5
  import torch
@@ -67,7 +67,7 @@ def label_text(text):
67
  49: 'B-TIME',
68
  50: 'I-TIME'}
69
 
70
- single_sentence_tokens = word_tokenize(text)
71
  tokenized_input = tokenizer(single_sentence_tokens, is_split_into_words = True, return_tensors = "pt")
72
  tokens = tokenized_input.tokens()
73
  output = model(**tokenized_input).logits
 
1
  from annotated_text import annotated_text, parameters, annotation
2
+ import razdel
3
  from transformers import AutoTokenizer, AutoModelForTokenClassification, pipeline
4
  import streamlit as st
5
  import torch
 
67
  49: 'B-TIME',
68
  50: 'I-TIME'}
69
 
70
+ single_sentence_tokens = [_.text for _ in list(razdel.tokenize(text))]
71
  tokenized_input = tokenizer(single_sentence_tokens, is_split_into_words = True, return_tensors = "pt")
72
  tokens = tokenized_input.tokens()
73
  output = model(**tokenized_input).logits