Spaces:
Sleeping
Sleeping
File size: 656 Bytes
200ce40 17a32cc 200ce40 17a32cc 200ce40 17a32cc 200ce40 17a32cc 200ce40 17a32cc 200ce40 17a32cc 200ce40 5b5117f |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
import streamlit as st
import spacy
# Load spaCy NLP model for NER
nlp = spacy.load("en_core_web_sm")
# Streamlit app
def main():
st.title("Named Entity Recognition (NER) Demo")
# User input
text_input = st.text_area("Enter text:", "John Doe is the CEO of ABC Corp, and it is located in New York.")
# NER processing
if st.button("Extract Entities"):
doc = nlp(text_input)
# Display entities
entities = [(ent.text, ent.label_) for ent in doc.ents]
st.write("Named Entities:")
for entity, label in entities:
st.write(f"- {entity} ({label})")
if __name__ == "__main__":
main()
|