Update detection_api.py
Browse files- detection_api.py +8 -5
detection_api.py
CHANGED
|
@@ -80,11 +80,10 @@ moderator: Optional[ContentModerator] = None
|
|
| 80 |
# Thread pool for background processing
|
| 81 |
executor = ThreadPoolExecutor(max_workers=config.MAX_WORKERS)
|
| 82 |
|
|
|
|
|
|
|
|
|
|
| 83 |
|
| 84 |
-
# Video Optimizer Class
|
| 85 |
-
class VideoOptimizer:
|
| 86 |
-
"""Optimized video processing for CPU environments"""
|
| 87 |
-
def StandaloneApplication(app, options=None):
|
| 88 |
class _App(BaseApplication):
|
| 89 |
def __init__(self, app, options=None):
|
| 90 |
self.options = options or {}
|
|
@@ -103,7 +102,11 @@ class VideoOptimizer:
|
|
| 103 |
return self.application
|
| 104 |
|
| 105 |
return _App(app, options)
|
| 106 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 107 |
def __init__(self):
|
| 108 |
self.frame_cache = {}
|
| 109 |
self.cache_size = 20
|
|
|
|
| 80 |
# Thread pool for background processing
|
| 81 |
executor = ThreadPoolExecutor(max_workers=config.MAX_WORKERS)
|
| 82 |
|
| 83 |
+
def StandaloneApplication(app, options=None):
|
| 84 |
+
"""Hàm bọc Gunicorn để chạy app"""
|
| 85 |
+
from gunicorn.app.base import BaseApplication
|
| 86 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 87 |
class _App(BaseApplication):
|
| 88 |
def __init__(self, app, options=None):
|
| 89 |
self.options = options or {}
|
|
|
|
| 102 |
return self.application
|
| 103 |
|
| 104 |
return _App(app, options)
|
| 105 |
+
|
| 106 |
+
|
| 107 |
+
# Video Optimizer Class
|
| 108 |
+
class VideoOptimizer:
|
| 109 |
+
|
| 110 |
def __init__(self):
|
| 111 |
self.frame_cache = {}
|
| 112 |
self.cache_size = 20
|