Wvolf commited on
Commit
80b3f89
1 Parent(s): fc6b71c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -6
app.py CHANGED
@@ -1,5 +1,5 @@
1
  import numpy as np
2
- from PIL import Image
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
- x = img_to_array(img)
13
 
14
- x = cv2.resize(x, (256, 256), interpolation=cv2.INTER_AREA)
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="image",
45
- outputs=gr.Label(num_top_classes=15,min_width=360),
46
- title="Deepfake Image Detection(CNN)",
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