analyze.py 465 B

123456789101112131415161718192021
  1. from flask import request
  2. from worker.thread_pool import pool
  3. from route.util import make_response
  4. from flask import Blueprint
  5. from service.photo import StandingPhotoAnalyzer
  6. bp = Blueprint("analyze", __name__, url_prefix='/')
  7. @bp.route("analysis", methods={"POST"})
  8. def start_analysis():
  9. req = request.get_json()
  10. ana = StandingPhotoAnalyzer()
  11. pool.submit(ana.analyze, (req['front'], req['right']))
  12. return make_response(201, "success", {})