ufal / factgenie

Lightweight self-hosted span annotation tool
https://quest.ms.mff.cuni.cz/nlg/d2t-llm/
MIT License
23 stars 2 forks source link

fix parse_crowdsourcing_config default empty strings #149

Closed oplatek closed 3 weeks ago

oplatek commented 3 weeks ago

Fixes the following error caused by non-complete campaign config (because it is outdated or human edited)

Traceback (most recent call last):
  File "/Users/oplatek/code/factgenie/venv/lib/python3.11/site-packages/flask/app.py", line 1473, in wsgi_app
    response = self.full_dispatch_request()
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/oplatek/code/factgenie/venv/lib/python3.11/site-packages/flask/app.py", line 882, in full_dispatch_request
    rv = self.handle_user_exception(e)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/oplatek/code/factgenie/venv/lib/python3.11/site-packages/flask/app.py", line 880, in full_dispatch_request
    rv = self.dispatch_request()
         ^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/oplatek/code/factgenie/venv/lib/python3.11/site-packages/flask/app.py", line 865, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)  # type: ignore[no-any-return]
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/oplatek/code/factgenie/factgenie/app.py", line 107, in wrapper
    return f(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^
  File "/Users/oplatek/code/factgenie/factgenie/app.py", line 297, in crowdsourcing_create
    config = crowdsourcing.parse_crowdsourcing_config(config)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/oplatek/code/factgenie/factgenie/crowdsourcing.py", line 259, in parse_crowdsourcing_config
    "annotators_per_example": int(config.get("annotatorsPerExample", 1)),
                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: invalid literal for int() with base 10: