Skip to content
Snippets Groups Projects

Resolve "combine matchsalamander with ai"

Files

from flask import request, jsonify
from flask_restful import Resource
from flask_jwt_extended import get_jwt_identity, jwt_required
from algorithm.train_src.new_straightening import straighten
ALLOWED_EXTENSIONS = ['jpeg', 'png', 'jpg']
@@ -17,6 +19,10 @@ class FindSalamanderInfo(Resource):
if image.filename != '':
if image and allowed_image(image.filename):
# run AI on image
str_image, _, _, _, _ = straighten(image)
if str_image:
str_image.filename = str(user_id) + "_str.png"
str_image.save("temp_images/" + str_image.filename)
# store processed and original image
image.filename = str(user_id) + "." + extension(image.filename)
image.save("temp_images/" + image.filename)
Loading