Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -1,5 +1,7 @@
|
|
1 |
-
import
|
2 |
-
|
|
|
|
|
3 |
|
4 |
import pandas as pd
|
5 |
import gradio as gr
|
@@ -26,7 +28,8 @@ color_map = {
|
|
26 |
|
27 |
|
28 |
def predict_doc(doc):
|
29 |
-
sents = sent_tokenize(doc)
|
|
|
30 |
data = {'sentence': [], 'label': [], 'score': []}
|
31 |
res = []
|
32 |
for sent in sents:
|
|
|
1 |
+
from spacy.lang.en import English
|
2 |
+
|
3 |
+
nlp = English()
|
4 |
+
nlp.add_pipe("sentencizer")
|
5 |
|
6 |
import pandas as pd
|
7 |
import gradio as gr
|
|
|
28 |
|
29 |
|
30 |
def predict_doc(doc):
|
31 |
+
# sents = sent_tokenize(doc)
|
32 |
+
sents = [s.text for s in nlp(doc).sents]
|
33 |
data = {'sentence': [], 'label': [], 'score': []}
|
34 |
res = []
|
35 |
for sent in sents:
|