Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -10,11 +10,6 @@ import moviepy.editor as mp
|
|
| 10 |
import os
|
| 11 |
import zipfile
|
| 12 |
|
| 13 |
-
# local_zip = "FINAL-EFFICIENTNETV2-B0.zip"
|
| 14 |
-
# zip_ref = zipfile.ZipFile(local_zip, 'r')
|
| 15 |
-
# zip_ref.extractall('FINAL-EFFICIENTNETV2-B0')
|
| 16 |
-
# zip_ref.close()
|
| 17 |
-
|
| 18 |
# Load face detector
|
| 19 |
mtcnn = MTCNN(margin=14, keep_all=True, factor=0.7, device='cpu')
|
| 20 |
|
|
@@ -24,15 +19,6 @@ class DetectionPipeline:
|
|
| 24 |
|
| 25 |
def __init__(self, detector, n_frames=None, batch_size=60, resize=None):
|
| 26 |
"""Constructor for DetectionPipeline class.
|
| 27 |
-
|
| 28 |
-
Keyword Arguments:
|
| 29 |
-
n_frames {int} -- Total number of frames to load. These will be evenly spaced
|
| 30 |
-
throughout the video. If not specified (i.e., None), all frames will be loaded.
|
| 31 |
-
(default: {None})
|
| 32 |
-
batch_size {int} -- Batch size to use with MTCNN face detector. (default: {32})
|
| 33 |
-
resize {float} -- Fraction by which to resize frames from original prior to face
|
| 34 |
-
detection. A value less than 1 results in downsampling and a value greater than
|
| 35 |
-
1 result in upsampling. (default: {None})
|
| 36 |
"""
|
| 37 |
self.detector = detector
|
| 38 |
self.n_frames = n_frames
|
|
@@ -153,22 +139,14 @@ def deepfakespredict(input_video):
|
|
| 153 |
|
| 154 |
|
| 155 |
|
| 156 |
-
title="EfficientNetV2
|
| 157 |
-
description=
|
|
|
|
|
|
|
| 158 |
|
| 159 |
-
examples = [
|
| 160 |
-
['Video1-fake-1-ff.mp4'],
|
| 161 |
-
['Video6-real-1-ff.mp4'],
|
| 162 |
-
['Video3-fake-3-ff.mp4'],
|
| 163 |
-
['Video8-real-3-ff.mp4'],
|
| 164 |
-
['real-1.mp4'],
|
| 165 |
-
['fake-1.mp4'],
|
| 166 |
-
]
|
| 167 |
-
|
| 168 |
gr.Interface(deepfakespredict,
|
| 169 |
inputs = ["video"],
|
| 170 |
outputs=["text","text", gr.Video(label="Detected face sequence")],
|
| 171 |
title=title,
|
| 172 |
-
description=description
|
| 173 |
-
examples=examples
|
| 174 |
).launch()
|
|
|
|
| 10 |
import os
|
| 11 |
import zipfile
|
| 12 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
# Load face detector
|
| 14 |
mtcnn = MTCNN(margin=14, keep_all=True, factor=0.7, device='cpu')
|
| 15 |
|
|
|
|
| 19 |
|
| 20 |
def __init__(self, detector, n_frames=None, batch_size=60, resize=None):
|
| 21 |
"""Constructor for DetectionPipeline class.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 22 |
"""
|
| 23 |
self.detector = detector
|
| 24 |
self.n_frames = n_frames
|
|
|
|
| 139 |
|
| 140 |
|
| 141 |
|
| 142 |
+
title="Group 2- EfficientNetV2 based Deepfake Video Detector"
|
| 143 |
+
description='''Please upload videos responsibly and await the results in a gif. The approach in place includes breaking down the video into several frames followed by collecting
|
| 144 |
+
the frames that contain a face. Once these frames are collected the trained model attempts to predict if the face is fake or real and contribute to a deepfake confidence. This confidence level eventually
|
| 145 |
+
determines if the video can be considered a fake or not.'''
|
| 146 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 147 |
gr.Interface(deepfakespredict,
|
| 148 |
inputs = ["video"],
|
| 149 |
outputs=["text","text", gr.Video(label="Detected face sequence")],
|
| 150 |
title=title,
|
| 151 |
+
description=description
|
|
|
|
| 152 |
).launch()
|