cancel
Showing results forย 
Search instead forย 
Did you mean:ย 
Machine Learning
Dive into the world of machine learning on the Databricks platform. Explore discussions on algorithms, model training, deployment, and more. Connect with ML enthusiasts and experts.
cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

Visualizations not displaying

DavidKxx
Contributor

With a copy of notebook https://github.com/JohnSnowLabs/spark-nlp-workshop/blob/master/open-source-nlp/03.0.SparkNLP_Pretrai... imported into Databricks, there's a lovely visualization created by the cell that you can locate by searching on "import NerVisualizer":

DavidKxx_0-1701107229407.png

However, when I actually run that cell, Databricks only gives me the following where the visualization ought to be:

DavidKxx_1-1701107287817.png

Is there a trick that will make the image show up?

Thanks.

 

1 ACCEPTED SOLUTION

Accepted Solutions

DavidKxx
Contributor

Here's a solution:  use a parameter (here, `return_html = True`) to get an HTML object back, and then call `displayHTML` to actually display the object.

from sparknlp_display import NerVisualizer

visualiser = NerVisualizer()

for i in text_list:

    light_result = light_model.fullAnnotate(i)
    html = visualiser.display(light_result[0], label_col='ner_chunk', document_col='document', return_html=True)
    displayHTML(html)

  

View solution in original post

1 REPLY 1

DavidKxx
Contributor

Here's a solution:  use a parameter (here, `return_html = True`) to get an HTML object back, and then call `displayHTML` to actually display the object.

from sparknlp_display import NerVisualizer

visualiser = NerVisualizer()

for i in text_list:

    light_result = light_model.fullAnnotate(i)
    html = visualiser.display(light_result[0], label_col='ner_chunk', document_col='document', return_html=True)
    displayHTML(html)