import streamlit as st from transformers import pipeline # Load NER model @st.cache_resource def load_ner_model(): return pipeline("ner", grouped_entities=True) ner_model = load_ner_model() # Set the title with custom style st.markdown( "
Enter your text below for entity recognition.
", unsafe_allow_html=True ) # Center the input text area text_input = st.text_area( "Text Input", placeholder="Type your text here...", height=200 ) # Customize the button and center it button_style = """ """ st.markdown(button_style, unsafe_allow_html=True) # Button to trigger NER model if st.button("Recognize Entities"): if text_input: with st.spinner("Processing..."): entities = ner_model(text_input) if entities: st.subheader("Named Entities") # Loop through entities and display with improved visibility for entity in entities: entity_html = f"""