import sentencepiece import streamlit as st import pandas as pd import spacy import roner example_list = [ "Ana merge în București.", """Ana merge în București. Ana merge în București. Ana merge în București. Ana merge în București. Ana merge în București. Ana merge în București.""" ] st.set_page_config(layout="wide") st.title("Demo for Romanian NER") model_list = ['dumitrescustefan/bert-base-romanian-ner'] st.sidebar.header("Select NER Model") model_checkpoint = st.sidebar.radio("", model_list) st.sidebar.write("This demo is based on RoNER: 'https://github.com/dumitrescustefan/roner'") st.sidebar.write("") st.sidebar.header("Select type of PERSON detection") named_persons_only_radio = st.sidebar.radio("", ('Proper nouns only', 'All nouns')) st.sidebar.write("Types of entities detected: 'PERSON', 'ORG', 'GPE', 'LOC', 'NAT_REL_POL', 'EVENT', 'LANGUAGE', 'WORK_OF_ART', 'DATETIME', 'PERIOD', 'MONEY', 'QUANTITY', 'NUMERIC', 'ORDINAL', 'FACILITY'") st.subheader("Select Text Input Method") input_method = st.radio("", ('Select from Examples', 'Write or Paste New Text')) if input_method == 'Select from Examples': selected_text = st.selectbox('Select Text from List', example_list, index=0, key=1) st.subheader("Text to Run") input_text = st.text_area("Selected Text", selected_text, height=128, max_chars=None, key=2) elif input_method == "Write or Paste New Text": st.subheader("Text to Run") input_text = st.text_area('Write or Paste Text Below', value="", height=128, max_chars=None, key=2) @st.cache(allow_output_mutation=True) def setModel(named_persons_only): ner = roner.NER(named_persons_only=named_persons_only) return ner @st.cache(allow_output_mutation=True) def get_html(html: str): WRAPPER = """