Hello awesome Streamlit community,
I hope you can help me solve this problem.
My web app idea is to extract entities and types from a given text, similar to the one from SpaCy:
but I’m using my own tool, and my output now looks like a regular df, something like this:
I am trying to display my dataframe in a way similar to SpaCy rather than just using st.write(df)
.
I want to display the df as a string, and only show the types that are recognized by my tool like “[‘thing’]”, and ignore displaying the ones that are not recognized “[-]”, and also remove the indexes and column names, so I did this:
st.write(df)
df2 = df[df['Types'] != '[-]']
st.write(df2.to_string(columns=['Text','Types'], header=False, index=False))
now it is almost showing what I want but, when avoiding printing the “[-]” types, it also avoids printing its corresponding Text of course because it is avoiding the whole row.
Does anyone know how to fix this to display it the way I explained?
Also, another question: is it possible to highlight the text with its entity type, in a color just like SpaCy?
Thanks in advance! appreciate the help.