Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Backend
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Analyze
Contributor analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Arkindex
Backend
Commits
09050dc2
Commit
09050dc2
authored
3 years ago
by
ml bonhomme
Browse files
Options
Downloads
Patches
Plain Diff
add missing default value on some endpoints
parent
1e21e475
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
arkindex/documents/serializers/ml.py
+4
-3
4 additions, 3 deletions
arkindex/documents/serializers/ml.py
with
4 additions
and
3 deletions
arkindex/documents/serializers/ml.py
+
4
−
3
View file @
09050dc2
...
...
@@ -271,7 +271,7 @@ class TranscriptionCreateSerializer(serializers.ModelSerializer):
max_value
=
1
,
required
=
False
,
)
orientation
=
EnumField
(
TextOrientation
,
required
=
False
)
orientation
=
EnumField
(
TextOrientation
,
default
=
TextOrientation
.
HorizontalLeftToRight
,
required
=
False
)
class
Meta
:
model
=
Transcription
...
...
@@ -328,7 +328,7 @@ class SimpleTranscriptionSerializer(serializers.Serializer):
max_value
=
1
,
required
=
False
,
)
orientation
=
EnumField
(
TextOrientation
,
required
=
False
)
orientation
=
EnumField
(
TextOrientation
,
default
=
TextOrientation
.
HorizontalLeftToRight
,
required
=
False
)
def
validate
(
self
,
data
):
if
not
(
'
score
'
in
data
)
^
(
'
confidence
'
in
data
):
...
...
@@ -400,7 +400,7 @@ class TranscriptionBulkItemSerializer(serializers.Serializer):
help_text
=
'
This field is deprecated; please use the `confidence` field instead.
'
)
confidence
=
serializers
.
FloatField
(
min_value
=
0
,
max_value
=
1
,
required
=
False
)
orientation
=
EnumField
(
TextOrientation
,
required
=
False
)
orientation
=
EnumField
(
TextOrientation
,
default
=
TextOrientation
.
HorizontalLeftToRight
,
required
=
False
)
def
validate
(
self
,
data
):
# Element retrieval and checks is done in the BulkSerializer to avoid duplicate queries
...
...
@@ -451,6 +451,7 @@ class TranscriptionBulkSerializer(serializers.Serializer):
worker_version
=
validated_data
[
'
worker_version
'
],
element_id
=
transcription
[
'
element_id
'
],
text
=
transcription
[
'
text
'
],
orientation
=
transcription
[
'
orientation
'
],
confidence
=
transcription
[
'
confidence
'
],
)
for
transcription
in
validated_data
[
'
transcriptions
'
]
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment