added image ai-moderation
This commit is contained in:
@@ -1,4 +1,32 @@
|
||||
from app.ml.model_manager import model_manager
|
||||
from functools import lru_cache
|
||||
|
||||
def get_model_manager():
|
||||
return model_manager
|
||||
from app.ml.text_classifier import TextClassifier
|
||||
from app.services.text_moderation_service import TextModerationService
|
||||
from app.ml.image.image_classifier import ImageClassifier
|
||||
from app.services.image_moderation_service import ImageModerationService
|
||||
from app.container import profanity_detector
|
||||
|
||||
@lru_cache
|
||||
def get_text_classifier() -> TextClassifier:
|
||||
return TextClassifier()
|
||||
|
||||
@lru_cache
|
||||
def get_text_moderation_service() -> TextModerationService:
|
||||
return TextModerationService(
|
||||
classifier=get_text_classifier(),
|
||||
profanity_detector=profanity_detector
|
||||
)
|
||||
|
||||
@lru_cache
|
||||
def get_image_classifier():
|
||||
|
||||
return ImageClassifier()
|
||||
|
||||
|
||||
|
||||
@lru_cache
|
||||
def get_image_moderation_service():
|
||||
|
||||
return ImageModerationService(
|
||||
classifier=get_image_classifier()
|
||||
)
|
||||
Reference in New Issue
Block a user