I would need to get SpaCy’s entity visualiser working for multiple text areas in Streamlit - yet it seems that SpaCy’s entity visualiser can’t be duplicated out of the box:
Currently, I’ve got the duplicateWidgetID error thrown on the 2nd text area - please see the screenshot below:
I’ve been trying various things on the spacy_streamlit visualizer.py file (which contains the visualize_ner function related to entity vizzes), yet every time either I get the duplicateWidgetID error, or other errors (which I would be happy to trace back here. :))
There must be something pretty easy to amend to enable it, yet I can’t seem to find what it is.
As always, any guidance would be uber appreciated!
To avoid duplicateWidgetID errors, you’ll have to play with the key parameter of Streamlit widgets.
Add a new key parameter in visualize that you’ll forward to every vizualize_*() function. And in every function, pass the key parameter to each streamlit widget that support it (which means all widgets you can interact with).
That done, you should be able to call visualize multiple times by passing a different key value each time:
It’s a strict duplication of visualize_ner with key=2 in lieu of key=1.
When trying the above, Streamlit is throwing the following AttributeError error:
AttributeError: module 'spacy_streamlit' has no attribute 'visualize_ner2'
Traceback:
File "c:\users\charly\desktop\streamlit spacy tests\venv\lib\site-packages\streamlit\ScriptRunner.py", line 319, in _run_script
exec(code, module.__dict__)
File "C:\Users\Charly\Desktop\Streamlit SpaCy tests\customMaster.py", line 43, in <module>
spacy_streamlit.visualize_ner2(
Am I understanding your explanation correctly? If so, is there anything else that I may need to tweak (possibly in ScriptRunner.py) in order to make this work?
Thanks for stopping by! We use cookies to help us understand how you interact with our website.
By clicking “Accept all”, you consent to our use of cookies. For more information, please see our privacy policy.
Cookie settings
Strictly necessary cookies
These cookies are necessary for the website to function and cannot be switched off. They are usually only set in response to actions made by you which amount to a request for services, such as setting your privacy preferences, logging in or filling in forms.
Performance cookies
These cookies allow us to count visits and traffic sources so we can measure and improve the performance of our site. They help us understand how visitors move around the site and which pages are most frequently visited.
Functional cookies
These cookies are used to record your choices and settings, maintain your preferences over time and recognize you when you return to our website. These cookies help us to personalize our content for you and remember your preferences.
Targeting cookies
These cookies may be deployed to our site by our advertising partners to build a profile of your interest and provide you with content that is relevant to you, including showing you relevant ads on other websites.