Spaces:
Sleeping
Sleeping
yeshpanovrustem
commited on
Commit
•
6fb6ead
1
Parent(s):
a4366fd
Update app.py
Browse files
app.py
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
from annotated_text import annotated_text, parameters, annotation
|
2 |
-
|
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 =
|
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
|