Spaces:
Runtime error
Runtime error
| import nltk | |
| nltk.download('stopwords') | |
| import pandas as pd | |
| #classify_abs is a dependency for extract_abs | |
| import classify_abs | |
| import extract_abs | |
| #pd.set_option('display.max_colwidth', None) | |
| import streamlit as st | |
| ########## Title for the Web App ########## | |
| st.title("Text Classification for Service Feedback") | |
| #st.header(body, anchor=None) | |
| #st.subheader(body, anchor=None) | |
| #Anchor is for the URL, can be custom str | |
| # https://docs.streamlit.io/library/api-reference/text/st.markdown | |
| ########## Create Input field ########## | |
| disease_or_gard_id = st.text_input('Input a rare disease term or a GARD ID.', 'Fellman syndrome') | |
| # st.code(body, language="python") | |
| #LSTM RNN Epi Classifier Model | |
| classify_model_vars = classify_abs.init_classify_model() | |
| #GARD Dictionary - For filtering and exact match disease/GARD ID identification | |
| GARD_dict, max_length = extract_abs.load_GARD_diseases() | |
| #BioBERT-based NER pipeline, open `entities` to see | |
| NER_pipeline, entity_classes = extract_abs.init_NER_pipeline() | |
| #max_results is Maximum number of PubMed ID's to retrieve BEFORE filtering | |
| max_results = st.sidebar.number_input(label, min_value=1, max_value=None, value=50) | |
| # https://docs.streamlit.io/library/api-reference/widgets/st.number_input | |
| # st.radio(label, options, index=0, format_func=special_internal_function, key=None, help=None, on_change=None, args=None, kwargs=None, *, disabled=False) | |
| # https://docs.streamlit.io/library/api-reference/widgets/st.radio | |
| filtering = st.sidebar.radio( | |
| "What type of filtering would you like?", | |
| ('Strict', 'Lenient', 'None')) | |
| extract_diseases = st.sidebar.checkbox("Extract Rare Diseases", value=False) | |
| # https://docs.streamlit.io/library/api-reference/widgets/st.checkbox | |
| #filtering options are 'strict','lenient'(default), 'none' | |
| if text: | |
| df = extract_abs.search_term_extraction(disease_or_gard_id, max_results, filtering, | |
| NER_pipeline, entity_classes, | |
| extract_diseases,GARD_dict, max_length, | |
| classify_model_vars) | |
| st.dataframe(df) | |
| #st.dataframe(data=None, width=None, height=None) |