From cf8c164d60012333781dfc901d0a287eef32351a Mon Sep 17 00:00:00 2001 From: Patrick Jentsch Date: Wed, 14 Feb 2024 14:24:21 +0100 Subject: [PATCH] allow .whl files for spacy nlp pipeline contributions --- app/contributions/spacy_nlp_pipeline_models/forms.py | 4 ++-- .../contributions/spacy_nlp_pipeline_models/create.html.j2 | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/contributions/spacy_nlp_pipeline_models/forms.py b/app/contributions/spacy_nlp_pipeline_models/forms.py index dc3ca781..d05e5681 100644 --- a/app/contributions/spacy_nlp_pipeline_models/forms.py +++ b/app/contributions/spacy_nlp_pipeline_models/forms.py @@ -16,8 +16,8 @@ class CreateSpaCyNLPPipelineModelForm(ContributionBaseForm): ) def validate_spacy_model_file(self, field): - if not field.data.filename.lower().endswith('.tar.gz'): - raise ValidationError('.tar.gz files only!') + if not field.data.filename.lower().endswith(('.tar.gz', ('.whl'))): + raise ValidationError('.tar.gz or .whl files only!') def __init__(self, *args, **kwargs): if 'prefix' not in kwargs: diff --git a/app/templates/contributions/spacy_nlp_pipeline_models/create.html.j2 b/app/templates/contributions/spacy_nlp_pipeline_models/create.html.j2 index 091c61ad..b19241c6 100644 --- a/app/templates/contributions/spacy_nlp_pipeline_models/create.html.j2 +++ b/app/templates/contributions/spacy_nlp_pipeline_models/create.html.j2 @@ -42,7 +42,7 @@ {{ form.hidden_tag() }}
- {{ wtf.render_field(form.spacy_model_file, accept='.tar.gz', placeholder='Choose a .tar.gz file') }} + {{ wtf.render_field(form.spacy_model_file, accept='.tar.gz,.whl', placeholder='Choose a .tar.gz or .whl file') }}
{{ wtf.render_field(form.title, material_icon='title') }}