Update app.py
Browse files
app.py
CHANGED
@@ -1,17 +1,16 @@
|
|
1 |
import gradio as gr
|
|
|
2 |
import tensorflow as tf
|
3 |
-
from PIL import Image
|
4 |
import numpy as np
|
5 |
|
6 |
-
# Load
|
7 |
-
model1 =
|
8 |
-
model2 =
|
9 |
|
10 |
def preprocess_image(image):
|
11 |
-
img =
|
12 |
-
img = img.
|
13 |
-
|
14 |
-
return np.expand_dims(img_array, axis=0)
|
15 |
|
16 |
def predict_image(image):
|
17 |
preprocessed_image = preprocess_image(image)
|
|
|
1 |
import gradio as gr
|
2 |
+
from huggingface_hub import from_pretrained_keras
|
3 |
import tensorflow as tf
|
|
|
4 |
import numpy as np
|
5 |
|
6 |
+
# Load models from Hugging Face Hub
|
7 |
+
model1 = from_pretrained_keras("arsath-sm/real-fake-face-detection-model1")
|
8 |
+
model2 = from_pretrained_keras("arsath-sm/real-fake-face-detection-model2")
|
9 |
|
10 |
def preprocess_image(image):
|
11 |
+
img = tf.image.resize(image, (150, 150))
|
12 |
+
img = img / 255.0
|
13 |
+
return tf.expand_dims(img, 0)
|
|
|
14 |
|
15 |
def predict_image(image):
|
16 |
preprocessed_image = preprocess_image(image)
|