[英]Jupyter Notebook is unable to access the Js from the local machine
Jupyter Notebook 無法從本地機器訪問 Js。
jupyter nbextension enable --py --sys-prefix widgetsnbextension
幫助
也沒有來自Jupyter 筆記本的任何解決方案:未檢測到小部件 Javascript
這是代碼
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()}")
這是完整的錯誤。
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'
我降級了 tqdm,這對我有用
pip3 install tqdm==4.40.0
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.