cancel
Showing results for 
Search instead for 
Did you mean: 
Machine Learning
cancel
Showing results for 
Search instead for 
Did you mean: 

Visualizations not displaying

DavidKxx
New Contributor III

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
New Contributor III

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
New Contributor III

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)