Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
import numpy as np
|
2 |
-
from PIL import
|
3 |
import gradio as gr
|
4 |
from tensorflow.keras.utils import img_to_array
|
5 |
from tensorflow.keras.models import load_model
|
@@ -9,9 +9,9 @@ model = load_model(r'deepfake_detection_model.h5')
|
|
9 |
|
10 |
def predict_image(img):
|
11 |
|
12 |
-
|
13 |
|
14 |
-
x =
|
15 |
|
16 |
x /= 255.0
|
17 |
|
@@ -41,9 +41,9 @@ example_data = ['AI POPE.jpg']
|
|
41 |
|
42 |
gr.Interface(
|
43 |
fn=predict_image,
|
44 |
-
inputs=
|
45 |
-
outputs=
|
46 |
-
title=
|
47 |
description=description_html,
|
48 |
allow_flagging='never',
|
49 |
examples=example_data
|
|
|
1 |
import numpy as np
|
2 |
+
from PIL import ImageOps
|
3 |
import gradio as gr
|
4 |
from tensorflow.keras.utils import img_to_array
|
5 |
from tensorflow.keras.models import load_model
|
|
|
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 |
|
|
|
41 |
|
42 |
gr.Interface(
|
43 |
fn=predict_image,
|
44 |
+
inputs='image',
|
45 |
+
outputs='text',
|
46 |
+
title='Deepfake Image Detection(CNN)',
|
47 |
description=description_html,
|
48 |
allow_flagging='never',
|
49 |
examples=example_data
|