Spaces:
Sleeping
Sleeping
directly upload the model without tensorflow
Browse files
app.py
CHANGED
@@ -1,11 +1,16 @@
|
|
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 =
|
8 |
-
model2 =
|
9 |
|
10 |
def preprocess_image(image):
|
11 |
img = tf.convert_to_tensor(image)
|
|
|
1 |
import gradio as gr
|
|
|
2 |
import tensorflow as tf
|
3 |
import numpy as np
|
4 |
+
from huggingface_hub import hf_hub_download
|
5 |
+
|
6 |
+
# Function to load model from H5 file
|
7 |
+
def load_model_from_hub(repo_id, filename):
|
8 |
+
model_path = hf_hub_download(repo_id=repo_id, filename=filename)
|
9 |
+
return tf.keras.models.load_model(model_path)
|
10 |
|
11 |
# Load models from Hugging Face Hub
|
12 |
+
model1 = load_model_from_hub("arsath-sm/real-fake-face-detection-model1", "face_detection_model1.h5")
|
13 |
+
model2 = load_model_from_hub("arsath-sm/real-fake-face-detection-model2", "face_detection_model2.h5")
|
14 |
|
15 |
def preprocess_image(image):
|
16 |
img = tf.convert_to_tensor(image)
|