Spaces:
Runtime error
Runtime error
Add app.py
Browse files
app.py
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import spacy
|
2 |
+
import streamlit as st
|
3 |
+
nlp = spacy.load("en_core_web_sm")
|
4 |
+
|
5 |
+
def return_NER(value):
|
6 |
+
doc = nlp(value)
|
7 |
+
return [(X.text, X.label_) for X in doc.ents]
|
8 |
+
|
9 |
+
# Add title on the page
|
10 |
+
st.title("Spacy - Named Entity Recognition")
|
11 |
+
|
12 |
+
# Ask user for input text
|
13 |
+
input_sent = st.text_input("Input Sentence", "Your input sentence goes here")
|
14 |
+
|
15 |
+
# Display named entities
|
16 |
+
for res in return_NER(input_sent):
|
17 |
+
st.write(res[0], "-->", res[1])
|