Spaces:
Sleeping
Sleeping
Commit
·
3e43257
1
Parent(s):
7a79e11
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import spacy
|
| 2 |
+
import gradio as gr
|
| 3 |
+
|
| 4 |
+
nlp = spacy.load("en_core_web_sm")
|
| 5 |
+
|
| 6 |
+
def ner(sentence):
|
| 7 |
+
doc = nlp(sentence)
|
| 8 |
+
ents = [(e.text, e.label_) for e in doc.ents]
|
| 9 |
+
return ents
|
| 10 |
+
|
| 11 |
+
app = gr.Interface(fn=ner, inputs="text", outputs = "text")
|
| 12 |
+
app.launch()
|