import spacy import streamlit as st # Load your trained SpaCy NER model nlp = spacy.load('my_ner') # Define a function to perform NER on user input def predict_ner(text): doc = nlp(text) ents = [(ent.text, ent.label_) for ent in doc.ents] return ents # Create the Streamlit app def main(): st.title("SpaCy NER Demo") # Add a text input for users to input their text text = st.text_input("Enter some text:") # If the user has entered some text, show the NER predictions if text: st.write("Predictions:") ents = predict_ner(text) for ent in ents: st.write(ent) if __name__ == '__main__': main()