lyc8503 4 lat temu
rodzic
commit
29abbbe4a5
1 zmienionych plików z 5 dodań i 8 usunięć
  1. 5 8
      backend_refactor/route/analyze.py

+ 5 - 8
backend_refactor/route/analyze.py

@@ -9,7 +9,7 @@ from db import db
 from db.task import Task
 from route.util import make_response
 from service.photo_analyzer import StandingPhotoAnalyzer
-from service.video_analyzer import JuanfuAnalyzer
+from service.video_analyzer import JuanfuAnalyzer, SitforwardAnalyzer
 from worker.thread_pool import pool
 
 # from service.video_analyzer import BaseVideoAnalyzer, CrunchVideoAnalyzer, HighKneesVideoAnalyzer, \
@@ -19,9 +19,9 @@ from worker.thread_pool import pool
 logging.basicConfig(format='%(asctime)s - %(name)s[line:%(lineno)d] - %(levelname)s: %(message)s',
                     level=logging.DEBUG)
 
-
 bp = Blueprint("analyze", __name__, url_prefix='/')
 
+
 def callback_generator(task_uuid):
     def callback(status, **kwargs):
         try:
@@ -33,11 +33,12 @@ def callback_generator(task_uuid):
                     task.result = json.dumps(kwargs['result'])
                 if status == 'ERROR':
                     logging.error("error analyzing: ", exc_info=kwargs['error'])
-                
+
                 db.session.commit()
                 logging.debug("calling to " + status)
         except Exception as e:
             logging.debug("nmsl", exc_info=e)
+
     return callback
 
 
@@ -51,10 +52,9 @@ def analysis():
         "VIDEO_CRUNCH": JuanfuAnalyzer,
         # "VIDEO_STANDINGLONGJUMP": StandingLongJumpVideoAnalyzer,
         # "VIDEO_PLANK": PlankVideoAnalyzer,
-        # "VIDEO_SQUAT": SquatVideoAnalyzer
+        "VIDEO_SQUAT": SitforwardAnalyzer
     }
 
-
     ana_type = types.get(req.get('type'))
 
     if ana_type is None:
@@ -65,8 +65,6 @@ def analysis():
     except Exception as e:
         return make_response(400, str(e), {})
 
-    
-
     with __import__("app").app.app_context():
         task_uuid = str(uuid.uuid4())
         new_task = Task(task_uuid, req.get('type'))
@@ -80,4 +78,3 @@ def analysis():
     logging.debug("task submited")
 
     return make_response(201, "success", {'task_uuid': task_uuid})
-