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)

  

Join 100K+ Data Experts: Register Now & Grow with Us!

Excited to expand your horizons with us? Click here to Register and begin your journey to success!

Already a member? Login and join your local regional user group! If there isn’t one near you, fill out this form and we’ll create one for you to join!