mirror of
https://github.com/s0md3v/roop.git
synced 2025-12-06 18:08:29 +00:00
Merge branch 'next' into issue_511_opencv_unicode_paths
This commit is contained in:
commit
44c3c790c6
@ -1,7 +1,6 @@
|
||||
import numpy
|
||||
import opennsfw2
|
||||
from PIL import Image
|
||||
from opennsfw2 import predict_video_frames
|
||||
|
||||
MAX_PROBABILITY = 0.85
|
||||
|
||||
@ -16,9 +15,9 @@ def predict_frame(target_frame: Image) -> bool:
|
||||
|
||||
|
||||
def predict_image(target_path: str) -> bool:
|
||||
return predict_image(target_path) > MAX_PROBABILITY
|
||||
return opennsfw2.predict_image(target_path) > MAX_PROBABILITY
|
||||
|
||||
|
||||
def predict_video(target_path: str) -> bool:
|
||||
_, probabilities = predict_video_frames(video_path=target_path, frame_interval=100)
|
||||
_, probabilities = opennsfw2.predict_video_frames(video_path=target_path, frame_interval=100)
|
||||
return any(probability > MAX_PROBABILITY for probability in probabilities)
|
||||
|
||||
@ -65,7 +65,7 @@ def restore_audio(target_path: str, output_path: str) -> None:
|
||||
|
||||
def get_temp_frame_paths(target_path: str) -> List[str]:
|
||||
temp_directory_path = get_temp_directory_path(target_path)
|
||||
return glob.glob(os.path.join(temp_directory_path, '*.png'))
|
||||
return glob.glob((os.path.join(glob.escape(temp_directory_path), '*.png')))
|
||||
|
||||
|
||||
def get_temp_directory_path(target_path: str) -> str:
|
||||
|
||||
Loading…
Reference in New Issue
Block a user