Jupyter Notebook is unable to access the Js from the local machine.
jupyter nbextension enable --py --sys-prefix widgetsnbextension
isnt helping
nor any of the solutions from Jupyter notebook: Widget Javascript not detected
Here is the code
from fonduer.parser.models import Document, Sentence
from fonduer.candidates.models import Mention
from fonduer.candidates import MentionExtractor
from tqdm import tqdm as tqdm
docs = session.query(Document).all()
mention_extractor = MentionExtractor(
session,
[Part, Attr],
[part_ngrams, attr_ngrams],
[part_matcher, attr_matcher],
parallelism=PARALLEL
)
mention_extractor.apply(docs)
print(f"Num Mentions: {session.query(Mention).count()}")
Here is the full error.
Full Error
Widget Javascript not detected. It may not be installed or enabled properly.
AttributeError Traceback (most recent call last)
<ipython-input-10-9b2839fa1727> in <module>
12 parallelism=PARALLEL
13 )
---> 14 mention_extractor.apply(docs)
15 print(f"Num Mentions: {session.query(Mention).count()}")
~/.local/lib/python3.8/site-packages/fonduer/candidates/mentions.py in apply(self, docs, clear, parallelism, progress_bar)
447 progress bar is measured per document.
448 """
--> 449 super().apply(
450 docs, clear=clear, parallelism=parallelism, progress_bar=progress_bar
451 )
~/.local/lib/python3.8/site-packages/fonduer/utils/udf.py in apply(self, doc_loader, clear, parallelism, progress_bar, **kwargs)
71 logger.debug("Setting up progress bar...")
72 if hasattr(doc_loader, "__len__"):
---> 73 self.pb = tqdm(total=len(doc_loader))
74 else:
75 logger.error("Could not determine size of progress bar")
~/.local/lib/python3.8/site-packages/tqdm/notebook.py in __init__(self, *args, **kwargs)
251 display(self.container)
252 self.disp = self.display
--> 253 self.colour = colour
254
255 # Print initial bar state
~/.local/lib/python3.8/site-packages/tqdm/notebook.py in colour(self, bar_color)
210 def colour(self, bar_color):
211 if hasattr(self, 'container'):
--> 212 self.container.children[-2].style.bar_color = bar_color
213
214 def __init__(self, *args, **kwargs):
AttributeError: 'FloatProgress' object has no attribute 'style'