sitwala commited on
Commit
1f789cc
·
1 Parent(s): d2d2f0c

first commit

Browse files
Files changed (1) hide show
  1. app.py +23 -0
app.py ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ !pip install -U spacy==3.0.0
2
+ !pip install gradio
3
+
4
+ import spacy
5
+ import gradio as gr
6
+
7
+ !python3 -m spacy download en_core_web_lg
8
+
9
+ nlp = spacy.load("en_core_web_lg")
10
+ def ner(text):
11
+ doc = nlp(text)
12
+ entities= []
13
+ for entity in doc.ents:
14
+ word = entity.text
15
+ label = entity.label_
16
+ entities.append((word,label))
17
+ return entities
18
+ examples = "Donald Trump is president of America"
19
+ demo = gr.Interface(ner,
20
+ gr.Textbox(placeholder="Enter sentence here..."),
21
+ gr.HighlightedText())
22
+
23
+ demo.launch(debug = True)