Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
-
import
|
2 |
-
|
3 |
import gradio as gr
|
4 |
from tensorflow.keras.utils import img_to_array
|
5 |
from tensorflow.keras.models import load_model
|
@@ -8,10 +8,10 @@ import os
|
|
8 |
model = load_model(r'deepfake_detection_model.h5')
|
9 |
|
10 |
def predict_image(img):
|
11 |
-
|
12 |
-
img = ImageOps.fit(img, (256, 256), Image.ANTIALIAS)
|
13 |
|
14 |
x = img_to_array(img)
|
|
|
|
|
15 |
|
16 |
x /= 255.0
|
17 |
|
|
|
1 |
+
import cv2
|
2 |
+
import numpy as np
|
3 |
import gradio as gr
|
4 |
from tensorflow.keras.utils import img_to_array
|
5 |
from tensorflow.keras.models import load_model
|
|
|
8 |
model = load_model(r'deepfake_detection_model.h5')
|
9 |
|
10 |
def predict_image(img):
|
|
|
|
|
11 |
|
12 |
x = img_to_array(img)
|
13 |
+
|
14 |
+
x = cv2.resize(x, (256, 256), interpolation=cv2.INTER_AREA)
|
15 |
|
16 |
x /= 255.0
|
17 |
|