Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -10,20 +10,13 @@ nlp = spacy.load("en_core_web_sm")
|
|
10 |
def text_analysis(text):
|
11 |
doc = nlp(text)
|
12 |
dependency_parsing = displacy.render(doc, style="dep", page=True)
|
13 |
-
named_entity_recognition = displacy.render(doc, style="ent",jupyter=False, page=True)
|
14 |
|
15 |
visual1 = (
|
16 |
"<div style='max-width:100%; overflow:auto'>"
|
17 |
+ dependency_parsing
|
18 |
+ "</div>"
|
19 |
)
|
20 |
-
|
21 |
-
visual2 = (
|
22 |
-
"<div style='max-width:100%; overflow:auto'>"
|
23 |
-
+ named_entity_recognition
|
24 |
-
+ "</div>"
|
25 |
-
)
|
26 |
-
|
27 |
rows = []
|
28 |
for token in doc:
|
29 |
rows.append((token.text, token.lemma_, token.pos_, token.tag_, token.dep_,
|
@@ -31,7 +24,7 @@ def text_analysis(text):
|
|
31 |
|
32 |
table = pd.DataFrame(rows, columns = ["TEXT", "LEMMA","POS","TAG","DEP","SHAPE","ALPHA","STOP"])
|
33 |
|
34 |
-
return table,
|
35 |
|
36 |
|
37 |
demo = gr.Interface(
|
|
|
10 |
def text_analysis(text):
|
11 |
doc = nlp(text)
|
12 |
dependency_parsing = displacy.render(doc, style="dep", page=True)
|
|
|
13 |
|
14 |
visual1 = (
|
15 |
"<div style='max-width:100%; overflow:auto'>"
|
16 |
+ dependency_parsing
|
17 |
+ "</div>"
|
18 |
)
|
19 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
rows = []
|
21 |
for token in doc:
|
22 |
rows.append((token.text, token.lemma_, token.pos_, token.tag_, token.dep_,
|
|
|
24 |
|
25 |
table = pd.DataFrame(rows, columns = ["TEXT", "LEMMA","POS","TAG","DEP","SHAPE","ALPHA","STOP"])
|
26 |
|
27 |
+
return table, visual1
|
28 |
|
29 |
|
30 |
demo = gr.Interface(
|