Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
nopaque
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Monitor
Service Desk
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SFB 1288 - INF
nopaque
Commits
d860a5d2
Commit
d860a5d2
authored
5 years ago
by
Patrick Jentsch
Browse files
Options
Downloads
Patches
Plain Diff
Set backrefs correctly.
parent
1e1ef8f9
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
app/main/views.py
+6
-5
6 additions, 5 deletions
app/main/views.py
app/models.py
+2
-2
2 additions, 2 deletions
app/models.py
app/services/views.py
+21
-25
21 additions, 25 deletions
app/services/views.py
with
29 additions
and
32 deletions
app/main/views.py
+
6
−
5
View file @
d860a5d2
...
...
@@ -24,16 +24,17 @@ def corpora(corpus):
@login_required
def
dashboard
():
create_corpus_form
=
CreateCorpusForm
()
print
(
current_user
.
corpora
.
all
())
print
(
current_user
.
jobs
.
all
())
if
create_corpus_form
.
validate_on_submit
():
app
=
current_app
.
_get_current_object
()
corpus
=
Corpus
()
corpus
.
creation_date
=
datetime
.
utcnow
()
corpus
.
description
=
create_corpus_form
.
description
.
data
corpus
.
title
=
create_corpus_form
.
title
.
data
corpus
.
user_id
=
current_user
.
id
corpus
=
Corpus
(
creator
=
current_user
.
_get_current_object
(),
description
=
create_corpus_form
.
description
.
data
,
title
=
create_corpus_form
.
title
.
data
)
db
.
session
.
add
(
corpus
)
db
.
session
.
commit
()
dir
=
os
.
path
.
join
(
app
.
config
[
'
OPAQUE_STORAGE
'
],
str
(
corpus
.
user_id
),
'
corpora
'
,
...
...
This diff is collapsed.
Click to expand it.
app/models.py
+
2
−
2
View file @
d860a5d2
...
...
@@ -113,8 +113,8 @@ class User(UserMixin, db.Model):
role_id
=
db
.
Column
(
db
.
Integer
,
db
.
ForeignKey
(
'
roles.id
'
))
username
=
db
.
Column
(
db
.
String
(
64
),
unique
=
True
,
index
=
True
)
# Relationships
corpora
=
db
.
relationship
(
'
Corpus
'
,
backref
=
'
c
orpus
'
,
lazy
=
'
dynamic
'
)
jobs
=
db
.
relationship
(
'
Job
'
,
backref
=
'
job
'
,
lazy
=
'
dynamic
'
)
corpora
=
db
.
relationship
(
'
Corpus
'
,
backref
=
'
c
reator
'
,
lazy
=
'
dynamic
'
)
jobs
=
db
.
relationship
(
'
Job
'
,
backref
=
'
creator
'
,
lazy
=
'
dynamic
'
)
def
__repr__
(
self
):
"""
...
...
This diff is collapsed.
Click to expand it.
app/services/views.py
+
21
−
25
View file @
d860a5d2
...
...
@@ -17,19 +17,17 @@ def ocr():
new_ocr_job_form
=
NewOCRJobForm
()
if
new_ocr_job_form
.
validate_on_submit
():
app
=
current_app
.
_get_current_object
()
ocr_job
=
Job
()
ocr_job
.
title
=
new_ocr_job_form
.
title
.
data
ocr_job
.
description
=
new_ocr_job_form
.
description
.
data
ocr_job
.
user_id
=
current_user
.
id
ocr_job
.
creation_date
=
datetime
.
utcnow
()
ocr_job
.
service
=
"
ocr
"
ocr_job
.
ressources
=
json
.
dumps
({
"
n_cores
"
:
2
,
"
mem_mb
"
:
4096
})
ocr_job
.
service_args
=
json
.
dumps
({
"
args
"
:
[
"
--keep-intermediates
"
,
"
--skip-binarisation
"
],
"
lang
"
:
new_ocr_job_form
.
language
.
data
,
"
version
"
:
new_ocr_job_form
.
version
.
data
})
ocr_job
.
status
=
"
queued
"
ocr_job
=
Job
(
creator
=
current_user
.
_get_current_object
(),
description
=
new_ocr_job_form
.
description
.
data
,
service
=
"
ocr
"
,
ressources
=
json
.
dumps
({
"
n_cores
"
:
2
,
"
mem_mb
"
:
4096
}),
service_args
=
json
.
dumps
({
"
args
"
:
[
"
--keep-intermediates
"
,
"
--skip-binarisation
"
],
"
lang
"
:
new_ocr_job_form
.
language
.
data
,
"
version
"
:
new_ocr_job_form
.
version
.
data
}),
status
=
"
queued
"
,
title
=
new_ocr_job_form
.
title
.
data
)
db
.
session
.
add
(
ocr_job
)
db
.
session
.
commit
()
...
...
@@ -69,18 +67,16 @@ def nlp():
new_nlp_job_form
=
NewNLPJobForm
()
if
new_nlp_job_form
.
validate_on_submit
():
app
=
current_app
.
_get_current_object
()
nlp_job
=
Job
()
nlp_job
.
title
=
new_nlp_job_form
.
title
.
data
nlp_job
.
description
=
new_nlp_job_form
.
description
.
data
nlp_job
.
user_id
=
current_user
.
id
nlp_job
.
creation_date
=
datetime
.
utcnow
()
nlp_job
.
service
=
"
nlp
"
nlp_job
.
ressources
=
json
.
dumps
({
"
n_cores
"
:
2
,
"
mem_mb
"
:
4096
})
nlp_job
.
service_args
=
json
.
dumps
({
"
args
"
:
[],
"
lang
"
:
new_nlp_job_form
.
language
.
data
,
"
version
"
:
new_nlp_job_form
.
version
.
data
})
nlp_job
.
status
=
"
queued
"
nlp_job
=
Job
(
creator
=
current_user
.
_get_current_object
(),
description
=
new_nlp_job_form
.
description
.
data
,
service
=
"
nlp
"
,
ressources
=
json
.
dumps
({
"
n_cores
"
:
1
,
"
mem_mb
"
:
2048
}),
service_args
=
json
.
dumps
({
"
args
"
:
[],
"
lang
"
:
new_nlp_job_form
.
language
.
data
,
"
version
"
:
new_nlp_job_form
.
version
.
data
}),
status
=
"
queued
"
,
title
=
new_nlp_job_form
.
title
.
data
)
db
.
session
.
add
(
nlp_job
)
db
.
session
.
commit
()
...
...
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