Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Salamander - API
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Herman Andersen Dyrkorn
Salamander - API
Commits
b0b8d6c0
Commit
b0b8d6c0
authored
4 years ago
by
Herman Andersen Dyrkorn
Browse files
Options
Downloads
Patches
Plain Diff
processing juvenile salamanders
parent
96ca710b
No related branches found
No related tags found
1 merge request
!18
Resolve "refactoring matchsalamander and register location endpoint"
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
api/endpoints/matchsalamander.py
+5
-8
5 additions, 8 deletions
api/endpoints/matchsalamander.py
with
5 additions
and
8 deletions
api/endpoints/matchsalamander.py
+
5
−
8
View file @
b0b8d6c0
...
...
@@ -6,6 +6,8 @@ import shutil
from
api
import
db
from
api.models.dbmodels
import
Location
from
api.models.dbmodels
import
Salamander
,
SalamanderGrowth
from
algorithm.train_src.new_straightening
import
straighten
from
algorithm.main_src.new_matching
import
match_file_strcture
APPROVED_SEX
=
[
"
male
"
,
"
female
"
,
"
juvenile
"
]
APPROVED_SPECIES
=
[
"
smooth_newt
"
,
"
northern_crested_newt
"
]
...
...
@@ -28,7 +30,7 @@ class MatchSalamander(Resource):
if
data
[
'
confirmed
'
]:
path_to_image_for_match
=
"
./temp_images/
"
+
str
(
user_id
)
+
"
_str.jpeg
"
path_to_original_image
=
"
./temp_images/
"
+
str
(
user_id
)
+
"
.jpeg
"
path_to_images
=
"
images/
"
+
data
[
'
location
'
].
lower
()
+
"
/
"
+
data
[
'
species
'
]
+
"
/
"
+
data
[
'
sex
'
]
+
"
/
"
path_to_images
=
"
./
images/
"
+
data
[
'
location
'
].
lower
()
+
"
/
"
+
data
[
'
species
'
]
+
"
/
"
+
data
[
'
sex
'
]
+
"
/
"
if
data
[
'
sex
'
]
!=
"
juvenile
"
:
hi
=
"
g
"
# start processing with AI
...
...
@@ -45,16 +47,11 @@ class MatchSalamander(Resource):
os
.
makedirs
(
path_for_new_salamander
)
move_and_rename_original
(
path_for_new_salamander
,
path_to_original_image
)
return
jsonify
({
"
message
"
:
"
new juvenile in database
"
,
"
id
"
:
salamander_id
[
0
]})
# if miss:
# create new salamander in DB
# save original image
# save processed image
# output = new salamander with ID something, no match
else
:
return
jsonify
({
"
message
"
:
"
i
nvalid sex or location
"
})
return
jsonify
({
"
message
"
:
"
i
mage was not accepted by user
"
})
else
:
return
jsonify
({
"
message
"
:
"
invalid sex or location
"
})
return
jsonify
({
"
message
"
:
"
invalid sex
, species
or location
"
})
else
:
return
jsonify
({
"
message
"
:
"
errors in form data
"
})
...
...
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