explosion/spacy-streamlit

Getting text or disabling text box from .visualizer

ritchieng opened this issue · 2 comments

When you use:

spacy_streamlit.visualize()

How do you get the textual data input into the text box? Can we disable that text box and feed directly into visualize instead?

polm commented

I'm not really clear what you're asking. Do you want to get the text in a variable like st.text() or something?

If you want to show the visualization with no text input you can just use one of the helpers directly, something like this:

import spacy
import spacy_streamlit

nlp = spacy.load("en_core_web_sm")
doc = nlp("This is a text")
spacy_streamlit.visualize_parser(doc)
polm commented

Closing due to lack of reply, but feel free to respond if you see this later.