janfreyberg / ipyannotations

Data annotations in python using jupyter notebooks
https://ipyannotations.readthedocs.io/
MIT License
53 stars 7 forks source link

Error in `ipyannotations.text.MulticlassLabeller` when used with Superintendent #42

Open morenobonaventura opened 1 year ago

morenobonaventura commented 1 year ago

Versions

Minimal script to reproduce (running via voila==0.4.0)

from superintendent import Superintendent
from IPython.display import display
from ipyannotations.text import MulticlassLabeller

label_classes = ['one', 'two', 'three']
labelling_widget = MulticlassLabeller(options=label_classes, allow_freetext=False)

if __name__ == '__main__':
    widget = Superintendent(labelling_widget=labelling_widget)
    a = [123, 123, 123]
    widget.add_features([a, a, a])
    display(widget)

Getting the following error with this minimal script

AttributeError                            Traceback (most recent call last)
/tmp/ipykernel_997/63846817.py in <module>
      4 
      5 label_classes = ['one', 'two', 'three']
----> 6 labelling_widget = MulticlassLabeller(options=label_classes, allow_freetext=False)
      7 
      8 if __name__ == '__main__':

/opt/conda/lib/python3.7/site-packages/ipyannotations/text/classification.py in __init__(self, options, max_buttons, allow_freetext, *args, **kwargs)
     79             display_function=_text_display_function,
     80             *args,
---> 81             **kwargs,
     82         )  # type: ignore
     83 

/opt/conda/lib/python3.7/site-packages/ipyannotations/generic/multiclassification.py in __init__(self, options, allow_freetext, display_function, *args, **kwargs)
     67         self._fixed_options = [option for option in self.options]
     68         self._freetext_timestamp = 0.0
---> 69         self.freetext_widget.on_submit(self.freetext_submission)
     70 
     71         self.children = [

AttributeError: 'HBox' object has no attribute 'on_submit'