use mjpeg and convert bgr to rgb
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import numpy
|
||||
import opennsfw2
|
||||
from PIL import Image
|
||||
import cv2 # Add OpenCV import
|
||||
|
||||
from modules.typing import Frame
|
||||
|
||||
@@ -10,6 +11,8 @@ MAX_PROBABILITY = 0.85
|
||||
model = None
|
||||
|
||||
def predict_frame(target_frame: Frame) -> bool:
|
||||
# Convert the frame to RGB before processing
|
||||
target_frame = cv2.cvtColor(target_frame, cv2.COLOR_BGR2RGB)
|
||||
image = Image.fromarray(target_frame)
|
||||
image = opennsfw2.preprocess_image(image, opennsfw2.Preprocessing.YAHOO)
|
||||
global model
|
||||
|
||||
Reference in New Issue
Block a user