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
6222e254
Commit
6222e254
authored
6 years ago
by
Bastien Abadie
Browse files
Options
Downloads
Patches
Plain Diff
Connect to ML worker for classification.
parent
35e318cb
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
arkindex/documents/models.py
+10
-0
10 additions, 0 deletions
arkindex/documents/models.py
arkindex/project/settings.py
+6
-0
6 additions, 0 deletions
arkindex/project/settings.py
with
16 additions
and
0 deletions
arkindex/documents/models.py
+
10
−
0
View file @
6222e254
...
...
@@ -3,6 +3,7 @@ from django.contrib.postgres.indexes import GinIndex
from
django.urls
import
reverse
from
enumfields
import
EnumField
,
Enum
from
arkindex.project.models
import
IndexableModel
from
arkindex.project.celery
import
app
as
celery_app
from
arkindex.documents.managers
import
ElementManager
from
arkindex.project.fields
import
ArrayField
import
uuid
...
...
@@ -329,6 +330,15 @@ class Page(Element):
out
.
append
(
self
.
direction
.
value
)
return
'
'
.
join
(
out
)
def
ml_classify
(
self
):
'''
Use a machine learning worker to classify the page
using its image
Celery is triggered through an external signature
'''
signature
=
celery_app
.
signature
(
'
arkindex_ml.tasks.classify
'
)
return
signature
.
delay
(
self
.
zone
.
image
.
get_thumbnail_url
(
max_width
=
None
))
class
Act
(
Element
):
"""
...
...
This diff is collapsed.
Click to expand it.
arkindex/project/settings.py
+
6
−
0
View file @
6222e254
...
...
@@ -312,6 +312,12 @@ CELERY_ONCE = {
'
default_timeout
'
:
3600
,
}
}
CELERY_TASK_ROUTES
=
{
# Route all machine learning work to specific workers
'
arkindex_ml.*
'
:
{
'
queue
'
:
'
ml
'
,
}
}
CELERY_WORKING_DIR
=
os
.
environ
.
get
(
'
CELERY_WORKING_DIR
'
,
os
.
path
.
join
(
BASE_DIR
,
'
workers
'
))
# Email
...
...
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